PDA

View Full Version : watermarks?? (FIXED IN 2.02)


wkitty42
20th of October 2006 (Fri), 11:45
i'm a bit confused on how the watermarks are supposed to be done... i had to look in the code to see that one needs a directory (admin/watermarks) and i believe i saw that several different filetypes can be used? jpeg, jpg, gif and png? but i'm a bit confused as each of those calls imagecreatefrompng which seems to indicate that the watermark files must be in png format?? :confused: :confused:

then it appears that i'm seeing that the file extension must be in all caps? :confused:

i'm still digging but would like to see more about this...

i'm also hoping there's a way to add the watermarks to my existing photos without having to upload them all over again... help? :confused:

wkitty42
31st of October 2006 (Tue), 12:17
well, after quite a bit of playing and digging, i (finally) have watermarks working in the sample preview for GD (admin/EDITOR_resize_methods.php)... i've added "some" code and now have it working with jpg, gif, and png file formats for the watermark file... i also seem to have it working before and after resizing and sharpening... in doing all this, i also added a little bit of output code that is a bit more informative about what's happening and when... for example GD2 RESIZE AND SHARPEN TEST PAGE AUTOGENERATED GD COMMANDS:
Add watermark to source file after resize & sharpen.
Source File Type: JPG
Read original (imageCreateFromJPEG) | OK
Create resized image template (imagecreatetruecolor) | OK
Resize in RAM and copy to template (imagecopyresampled) | OK
Watermark File Type: PNG
Read watermark (imagecreatefrompng) | OK
Merge both in RAM (imagecopymerge) | OK
Save JPEG (imagejpeg) | OK
RESIZE RESULT:
result_a1918db.jpg (54.48 KB)GD2 RESIZE AND SHARPEN TEST PAGE AUTOGENERATED GD COMMANDS:
Add watermark to source file before resize & sharpen.
Source File Type: JPG
Read original (imageCreateFromJPEG) | OK
Watermark File Type: GIF
Read watermark (imagecreatefromgif) | OK
Merge both in RAM (imagecopymerge) | OK
Create resized image template (imagecreatetruecolor) | OK
Resize in RAM and copy to template (imagecopyresampled) | OK
Save JPEG (imagejpeg) | OK
RESIZE RESULT:
result_c68f089.jpg (53.14 KB)
now, i'd like to get this working on actual uploads as well as possibly expanding it to the other graphic processing code if it is needed... i don't have imagemagic and so can't test or play with any of that...

pekka, can i upload this to you and see what you think about it? you are free to use it if you like... it would be nice to have an easier way of doing it instead of a lot of switch and case statements... however, like you, i prefer to code simply and straight forward ;)

wkitty42
31st of October 2006 (Tue), 22:28
Well, after several hours of working at a paying job and getting my mind off of things, i was able to sail right thru the code and determine what file the gd resizing stuff is in... minutes later, the mods were in place for watermarking with jpg, gif, and png files :) i'm a happy camper! the offer to share is still open, pekka! i'd love to contribute something to the cause... oh, i was also able to do a little bit of optimizing and shrinking of code... that should help things a bit ;) 8) pm me or something, eh?

deblur
4th of December 2006 (Mon), 07:34
I'm trying to get the watermarks to work with GD, however can't seem to get the transparency to do anything!

I saved 24 bit transparent PNG with a layer mask using 'save for web' in photoshop, all appears ok in the preview in PS, but when I try the preview in Resize methods in EE the transparency isn't showing up! Do the GD watermarks support transparency?

wkitty42
4th of December 2006 (Mon), 20:36
IIRC, the problem is that code is duplicated in the test and the actual application of the watermarks... i'll have to go back and check to see unless pekka has some input that will clarify for us...

deblur
7th of December 2006 (Thu), 20:05
do you mean it should work in one of them? For me neither the test nor the actual application is working right. Did you have to make any modifications to the code for transparency to work properly? Do you think it's just not reading the transparency or not applying it when it gets merged?

wkitty42
7th of December 2006 (Thu), 23:04
i didn't make any changes that would effect any type of transparency... my mods allow one to use more pic formats as the watermark file than the one or two that were coded... my mods also allow all these formats to be used on all formats (except tif(f), xmb, and a few others)... the major formats are supported by my mods...

i'm trying to figure out what transparency you are speaking of, too... i don't see any settings for transparency with regard to the watermark file and how it is applied... this may possibly be attributed to the fact that i only use the GD library for my eE photo manipulations...

i will say that i played for a while with "transparency" in my watermark test files to get them down to pretty unobtrusive but still recognizable... that was all a manual thing, though and i could only test it in eE to see the results... i also had to do this testing with regard to the "apply before" or "apply after" resize options...

deblur
8th of December 2006 (Fri), 06:39
by transparency, I mean if I make a watermark in phtoshop that has transparent pixels (e.g. a layer mask, channel mask etc.), then I can save it as a .png with that transparency information. Only that EE/GD doesn't seem to recognize that transparency data... I'm wondering if this is a known limitation?

Basically I'd like my watermark to be in the form of some text. If I put it on top of another layer in photoshop, obviously the image below shows through the transparent parts while the text obscures it. However when applying it with EE/GD, the transparency isn't used and the result is simply the watermark file completely obscures the underlying image, i.e. the pixels that should have been transparent are all solid white. If I'm not explaining that well, I can attach some example pictures...

wkitty42
9th of December 2006 (Sat), 09:28
ahhh, i thought that was possibly where you were headed... PNG transparency isn't recognized by all graphical tools... it isn't that eE doesn't recognise it but the tools you are using don't...

the only transparency stuff that i /know/ works universally, at this time, is GIF... so convert your watermarks over to GIF and see how it goes then... it is what i had to do... in my case, i had to go into the code to find out how the watermarks were even supposed to be used... where they were to be located and then what format(s) were supported... it was while in there that i saw that not all formats for watermark pics were supported on all photo formats... so i made my code updates, tested them, and offered them to pekka... i guess he doesn't want my updates in that area as he hasn't responded in all this time... i just hope that i don't loose the needed capabilities that i have now during an update...

Pekka
9th of December 2006 (Sat), 10:10
ahhh, i thought that was possibly where you were headed... PNG transparency isn't recognized by all graphical tools... it isn't that eE doesn't recognise it but the tools you are using don't...

the only transparency stuff that i /know/ works universally, at this time, is GIF... so convert your watermarks over to GIF and see how it goes then... it is what i had to do... in my case, i had to go into the code to find out how the watermarks were even supposed to be used... where they were to be located and then what format(s) were supported... it was while in there that i saw that not all formats for watermark pics were supported on all photo formats... so i made my code updates, tested them, and offered them to pekka... i guess he doesn't want my updates in that area as he hasn't responded in all this time... i just hope that i don't loose the needed capabilities that i have now during an update...

:rolleyes: Refresh my memory please, was your info in PM or in forum messages? Because I have missed those.

deblur
9th of December 2006 (Sat), 11:30
the only transparency stuff that i /know/ works universally, at this time, is GIF... so convert your watermarks over to GIF and see how it goes then... it is what i had to do... in my case, i had to go into the code to find out how the watermarks were even supposed to be used... where they were to be located and then what format(s) were supported..

ok, I have tried with transparent GIF. As you say, it doesn't work - the watermark doesn't appear at all becayse imagecreatefrompng fails. So I replaced imagecreatefrompng with imagecreatefromgif in the EDITOR_preview_gd.php file, and it does seem to work now! So if you've already fixed up the code with all the different watermark options, I'd sure appreciate a copy too!

On the other hand I'm still interested in the fact that the default option is to have wartermarks in png format, whilst GD doesn't support transparency with png's - does anyone really use non-transparent watermarks? ;)

Pekka
10th of December 2006 (Sun), 17:38
I've debugged the GD2 watermarking problems and I have fixed it so that it accepts jpeg, jpg, gif or png watermark. Gif and png have transparency support (8 or 24 bits), and it works. I'll post the new code with 2.02 in next 24 hours.

deblur
11th of December 2006 (Mon), 06:14
great... looking forward to it :)

Pekka
12th of December 2006 (Tue), 19:39
See http://photography-on-the.net/forum/showthread.php?t=250579

wkitty42
12th of December 2006 (Tue), 21:35
:rolleyes: Refresh my memory please, was your info in PM or in forum messages? Because I have missed those.

my apologies, pekka... i know that you've been busy with everything... that's an impressive list of fixes in 2.02... my info/question is/was at the top of this thread... i started the thread by asking about stuff and then dug in and posted more info... however, i didn't post my code/fixes because i wanted to give them to you and let you decide... scroll to the top and take a peek ;)

my offer still stands, too :cool: