Page 1 of 1

Make transparent areas white converting from png to jpg

Posted: Sat Aug 25, 2012 12:43 pm
by doobox
Hi there,

I set about converting an image, from a png that contains transparency around the outer edges, to a jpg file saved to disk.

So great i can simply do this and i am 99% there :

Code: Select all

on mouseUp
   // image "mail" below contains a png with transparency
   export image "mail" to myImageContent as JPEG
   put specialfolderpath("desktop") & "/miniVersion.jpg" into tOutputPath
   put myImageContent into URL("binfile:" & tOutputPath)
end mouseUp
Trouble is, i don't seem to have any control over the background color of the output jpg file.
It always makes the transparent areas black... I would like white.
Is this possible to control..?

Re: Make transparent areas white converting from png to jpg

Posted: Sat Aug 25, 2012 1:03 pm
by Klaus
Hi Gary,

you can:
1. deal with imagedata and maskdata (way over my head :D ) or
2. put your image in front of a white graphic (same size as image) and export a snapshot of that rect. 8)


Best

Klaus

Re: Make transparent areas white converting from png to jpg

Posted: Sat Aug 25, 2012 1:46 pm
by doobox
"Snapshot" :-) Why did'nt i think of that.....

Thank's Klaus as always, for keeping me on the straight and narrow.