There is a bug in the imagemask code such that you can/will get MANY errors:
Notice: imagecolorat() [function.imagecolorat]: 0,496 is out of bounds in image_gd_imagemask() (line 111 of /Users/rwohleb/Desktop/WWW/RMCC/docroot/sites/all/modules/imagecache_actions/canvasactions/canvasactions.inc).
Notice: imagecolorat() [function.imagecolorat]: 1,496 is out of bounds in image_gd_imagemask() (line 111 of /Users/rwohleb/Desktop/WWW/RMCC/docroot/sites/all/modules/imagecache_actions/canvasactions/canvasactions.inc).
Notice: imagecolorat() [function.imagecolorat]: 2,496 is out of bounds in image_gd_imagemask() (line 111 of /Users/rwohleb/Desktop/WWW/RMCC/docroot/sites/all/modules/imagecache_actions/canvasactions/canvasactions.inc).
Luckily it's a simple fix. Patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | beauty-alpha.png | 34.89 KB | paskainos |
| #7 | girls_night_out_party.jpg | 237.37 KB | paskainos |
| imagecache_actions_imagemask_colorat_outofbounds.patch | 529 bytes | rwohleb |
Comments
Comment #1
lindsayo commentedGreat happiness and rejoicing! That worked. Thank you, Mr. Wohleb.
Comment #2
filnug commentedSorry if my question is stupid. But I never had to use a patch.
how can I do to use your patch ? paste the code somewhere in the "canvasactions.inc" ?
thank you
Comment #3
fietserwinCurrent dev version already contains these changes. So marking as fixed.
Comment #5
paskainos commentedI'm seeing this behavior in 7.x-1.4, in spite of the mitigating (patch) code. And what's most confusing is, the two images don't appear to even be different sizes. Any ideas what I'm missing?
Comment #6
fietserwinCan you post your image style and the images (1 source and mask) that are giving you this message? Can you also post a few of the messages as well.
Notes:
- Posting the image style is done with the export feature of the image admin sub-module.
- What is your PHP version?
Comment #7
paskainos commenteda:2:{s:4:"name";s:11:"beauty_shot";s:7:"effects";a:3:{i:6;a:3:{s:4:"name";s:24:"smartcrop_scale_and_crop";s:4:"data";a:3:{s:5:"width";s:4:"1200";s:6:"height";s:3:"600";s:7:"upscale";i:0;}s:6:"weight";s:1:"1";}i:7;a:3:{s:4:"name";s:23:"canvasactions_imagemask";s:4:"data";a:1:{s:4:"path";s:25:"public://beauty-alpha.png";}s:6:"weight";s:1:"2";}i:8;a:3:{s:4:"name";s:20:"coloractions_convert";s:4:"data";a:2:{s:6:"format";s:9:"image/png";s:7:"quality";s:2:"50";}s:6:"weight";s:1:"3";}}}
Type php
Location ./admin/config/media/image-styles/edit/beauty_shot
Referrer ./admin/config/media/image-styles
Message Notice: imagecolorat() [function.imagecolorat]: 818,530 is out of bounds in image_gd_imagemask() (line 120 of ./sites/all/modules/imagecache_actions/canvasactions/canvasactions.inc).
Severity notice
All the other messages are identical, with the exception of the pixel coordinates (and time/date stamp of course). Let me know if I need to provide more info.
PS don't judge based on the project (image). This project is for a limo service, and the 'creative direction' wasn't our decision.
Comment #8
fietserwinI cannot reproduce it on Windows/Apche/Zend PHP5.4 with this GD version (from phpinfo (admin/reports/status/php):
gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.8
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.2.44
WBMP Support enabled
XBM Support enabled
Can you add these 2 lines to the code, just before the double loop:
and report the results.
Note: images are absolutely not "about the same size", but it should work without warnings.
Comment #9
paskainos commentedDone. What results am I reporting?
UPDATE:
Message:
image(1200,600); mask(1200,600)
image(1200,600); mask(1200,600)
Since I can't access (or edit) the image style in the UI, I had to
drush image-flushit to get the message to appear (rebuild image(s)).Comment #10
fietserwin- 818,530 is not out of bounds with the images processed at your site.
- The images you provided in #7 are not the same size.
- So you either provided different images or you have a scale effect before applying the mask
Oops. now I see, you use smart scale and crop, that is not our effect and I haven't installed it, so it did not appear in my style. I'll test again today.
You can't access or edit it, but you could export it? Seems strange to me,you must have 'administer image styles' permission to export. If it is a style define by a module (features), you can override it. subsequently by just saving the style without altering it you flush the directory.
Comment #11
paskainos commentedI'm not sure I understand, but I'll clarify what I can:
UPDATE:
I sincerely apologize for the wasted time. Upon further investigation, the problem was (obviously, above) that effects 2 & 3 were in the wrong order. Hopefully this experience may at least prove useful for other(s) in the future. Thanks, @fietserwin for your help. Sorry for wasting your time.
Comment #12
fietserwinThis cannot be the source of the problem. Changing the file format can be done at any time in an image style, but has only effect on the save method at the end. Regardless the original image format, it is (a.o.) the mask effect that makes GD to internally start working with alpha transparency, even if the opened image did not have it.
Comment #13
paskainos commentedI am baffled. I deleted the image style in question, and have recreated it a few times using the aforementioned effects, and it works as expected every time. I have no idea what caused the problem was at this point.