Make transparent areas white converting from png to jpg

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Make transparent areas white converting from png to jpg

Post by doobox » Sat Aug 25, 2012 12:43 pm

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..?
Kind Regards
Gary

https://www.doobox.co.uk

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Make transparent areas white converting from png to jpg

Post by Klaus » Sat Aug 25, 2012 1:03 pm

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

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Make transparent areas white converting from png to jpg

Post by doobox » Sat Aug 25, 2012 1:46 pm

"Snapshot" :-) Why did'nt i think of that.....

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

https://www.doobox.co.uk

Post Reply