Creating watermark with transparency on jpeg using PIL?

Terry Hancock hancock at anansispaceworks.com
Thu Aug 18 22:15:37 CEST 2005


On Thursday 18 August 2005 10:07 am, tvmaly at gmail.com wrote:
> I have been trying to add a watermark to a jpeg using PIL, but the
> watermark has a black box around it.  I looked at
[...]
> but I think these only refer to gif or png.  I know jpegs really do not
> support transparency, but is there some way to take a watermark in a
> non jpeg format and add it to a jpeg without that box appearing around
> it?

Jpeg is a lossy compression format. You shouldn't do image processing
in such a format at all.  Convert the data to PNG, do your processing,
and convert back to JPG for delivery.   PIL can do that.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list