cubicdaiya / ngx_small_light

Dynamic Image Transformation Module For nginx.
Other
472 stars 80 forks source link

GD image alpha is inverted #9

Open SteveMarshall opened 10 years ago

SteveMarshall commented 10 years ago

Hi,

I’ve been working with ngx_small_light for the last week and, after discovering that ImageMagick struggles under load (~1/10-1/2 of all requests fail with it), I tried switching to GD. Thankfully, GD is much better at coping with load, but I discovered that it expects, per libgd.h, 0-127 as its alpha value, with 0 being transparent.

I was wondering if it would be possible to put some fix into ngx_small_light to mask that from the front-end? I would’ve submitted a patch, but wasn't sure the best way to formulate a test for it.

Thanks for a great module!

cubicdaiya commented 10 years ago

@SteveMarshall

Hi, thanks for your report.

I discovered that it expects, per libgd.h, 0-127 as its alpha value, with 0 being transparent.

Sorry. I could not understand about the above described very well. Would you mind explaining about your problem more specifically?

I was wondering if it would be possible to put some fix into ngx_small_light to mask that from the front-end? I would’ve submitted a patch, but wasn't sure the best way to formulate a test for it.

Could you submit a patch tentatively? So that I'll review it.(It might take time to complete the review as I'm a little busy recently)

SteveMarshall commented 10 years ago

Hey, sorry, I wrote that the wrong way around: GD treats 0 alpha as opaque, 127+ as transparent (where ImageMagick has 0 alpha as transparent and 255 as opaque).

I’ll try to work up a patch this week.