A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Image mask with embedded path

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    4

    Image mask with embedded path

    Hello all you Flash gurus!

    I have been scouring the web for a solution to this problem but I haven't found anything so you're my last hope.

    I want to be able to mask an imported jpg using a path that is embedded in the jpg file.
    And for all of you who says "Doh, just use a PNG" I can't, and it's terrible.
    What I can use is about 600 jpg files with a embedded clipping path, all different shape and sizes (So a standard square mask won't help me).

    All of them with a white background and an embedded path. I've uploaded a version of one of the files here, so you can see for youself:
    http://dl.dropbox.com/u/1197434/Para...kshot_salg.jpg

    Hopefully one of you suave gentlemen can point me in the right correction, or help me accept that it's just not possible..

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Hi,

    can you please define 'embedded clipping path'? What is it? Are you saying that you want to remove all the whiteness from the JPEG images without the use of PNG transparent images?
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    Thats correct, inside the jpg file are the standard bitmap data channels and pixels, but in addition to that there is also a clipping path which is essentially a vector "shape" of the object.
    To better see what i mean, open the jpg i have linked in photoshop and check the "path" panel.
    Note that this is sort of the same procedure as an additional alpha channel that you use to mask the image, only in this case it's an embedded vector path.

    hopefully that makes sense?

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Well, I tried searching for how to import paths into Flash, but it didn't work, the path just appeared empty. Sorry for not being able to help you with this as I didn't know of paths in Photoshop until now (and had no idea what you were referring to). You'll just have to either manually remove the background or use some kind of tool to do so.
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  5. #5
    Member
    Join Date
    May 2012
    Posts
    51
    Are you trying to load the JPEG file dynamically or are you importing them in to Flash Professional? If it's the latter, I don't see why you can't just batch convert the files to PNG in Photoshop and then import the alpha-channel PNG into Flash.

  6. #6
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    Quote Originally Posted by cleong View Post
    Are you trying to load the JPEG file dynamically or are you importing them in to Flash Professional? If it's the latter, I don't see why you can't just batch convert the files to PNG in Photoshop and then import the alpha-channel PNG into Flash.
    As i stated in my post I can't use PNG, i'm loading the files dynamically into flash from another host, based on product targeting xml functionality, so I can't touch the files before they get loaded into my swf.

  7. #7
    Member
    Join Date
    May 2012
    Posts
    51
    Well, there's no built-in support in Flash. You'll have to parse the stuff manually. It's definitely doable in AS3, though far from trivial. The steps as roughly as follows:

    1. Scan through the JFIF tags looking for ones with the APP13 (Photoshop extension) marker.
    2. Check the identifier to see if it's is "Photoshop 3.0". If it is, then what follows is a series of 8BIM records.
    3. 8BIM records with ids between 1999 and 2998 contains path information. It contains a null terminated string with the name of the path follows by the path data.

  8. #8

  9. #9
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    Quote Originally Posted by cleong View Post
    Oh damn, that is amazing! That's exactly what I was looking for, I just tested the code out and it works impeccably.

    I must admit that I had really resigned myself to the fact that it wouldn't be doable but damn son... you are good..

  10. #10
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    you are good
    I second that, as he keeps surprising all the time with his amazing skills O_O
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center