#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    67
    Rep Power
    10

    How to convert jpeg/jpg format to png/gif transparent format


    Hi all,

    I am currently making a website that has e-custom functions and a back end for the client.

    I want them to be able to upload images - but they need to be transparent. I do not want to leave this in the hands of the client, so I am looking at ways of using the GD library to make the change

    I got no issue with the png/gif type for upload/resize function since this type already transparent background but my major problems is how to deal with jpeg/jpg image type which is their background was not a transparent...so is it possible I can change/ convert to png/gif type upon successful of uploading image...so the new final image will be png/gif type with transparent background...is it doable...I am not even sure it is possible...?

    Thanks for any help..
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    No, it's pretty much not possible. You'd have to dynamically determine what the "background" is, figure out all the colors in the background, then make each pixed in the background of that color transparent.

    Re-work your site design so that it doesn't matter if they're transparent or not, or tell your clients that it will look stupid unless they do it properly.

    -Dan

    Comments on this post

    • f_nietzsche agrees
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    67
    Rep Power
    10
    Originally Posted by ManiacDan
    No, it's pretty much not possible. You'd have to dynamically determine what the "background" is, figure out all the colors in the background, then make each pixed in the background of that color transparent.

    Re-work your site design so that it doesn't matter if they're transparent or not, or tell your clients that it will look stupid unless they do it properly.

    -Dan
    Thanks for the reply ManiacDan and for the tips...

    only just wanna make clearify maybe u misunderstanding regarding the site I'm currently developed...it's actually was a Flex t-shirt custom design site base which is the user will uploading an image on top of the shirt ...that's the reason It's need to be transparent background image before I send to my flex app...but anyway thanks for the tips....
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    You can try to figure out how cafe press does it, but it's not going to be easy.

    Generally, the printer handles this. When the image is sent along, only the bits that contrast with the target garment's color are printed, the rest are discarded. I don't know if the onus of doing that is on you, but I would assume the printer would have something in place to prevent them printing a huge white square on a white shirt.

    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo