I have tried doing rounded corners using following actions but the image files get too big
Scale And Crop* 300x200
Change File format Convert to : png
Rounded Corners Radius: 16px
image without rounded corner is 15kb
with rounded corner around 115kb
I have tried doing the same with
Scale And Crop 300x200
Define Canvas 300x200 (center, center) #ffffff under image
Rounded Corners Radius: 16px
but the file size is the same as a png around 115kb
on closer inspection trying to insert an imagecached image on photoshop I get
Could not complete your request because an unknown or invalid JPEG marker type is found.
if I rename the file as .png then photoshop opens up the image and the rounded corners are transparent !??!! (instead of white)
I have flushed the preset and made sure the corresponding folder is empty
I am calling the imagecached image directly after clearing the browser cache
but to no avail
Finally I came up with the following set of actions which produce a small file size with rounded corners
Change File format Convert to : png
Scale And Crop 300x200
Rounded Corners Radius: 16px
Define Canvas 300x200 (center, center) #ffffff under image
Change File format Convert to : jpg
and I get 15kb correct jpg (with .jpg extension) files
Comments
Comment #1
dman commentedCorrect.
That's what the instructions say:
Note: the rounded corners effect uses true alpha transparency masking.
This means that this effect will fail to be saved on jpegs
unless you either
as a later part of this imagecache pipeline.
Saving it as a PNG gives you transparency but inefficiently large file sizes (and the conversion to png does not accurately change the suffix). There's not much we seem to be able to do about that Though I've looked at it before
Saving it as a jpeg is fine provided you follow instruction #2 instead.
You don't need the 'convert to png' / 'convert to jpg' steps, but otherwise you've follwoed the instructions correctly.
Comment #2
giorgoskthese instructions will create jpg image with correct extension
Comment #5
Sinan Erdem commentedConverting to JPEG disables rounded corners. I tried it with either adding a canvas, or a background image separately...
Comment #6
Sinan Erdem commentedSorry for my previous comment. I was doing the order wrong as:
Making it as mentioned at comment #2 works...
Comment #7
Sinan Erdem commentedComment #8
asb commentedThis results in pure white image files with 900x250px dimensions and without rounded corners:
This gives me an uncropped segment of the original image (seems to break "Focus Scale And Crop"), again without rounded corners:
This produces scaled and cropped images, of course without rounded corners:
If the comment above would be correct, this image whould not even be saved.
ImageAPI is configured to use ImageMagick, because GD library 2.0 on Debian Lenny results in these warnings:
Also, when disabling ImageMagick and enabling GD, I'm getting the even worse results: not even white image files are generated, and none of this gives a preview image.
Does this Imagecache action actually work for anyone? Can Debian users safely uninstall 'Imagecache actions' because Imagemagick isn't spported, and the GD library is incompatible?
Comment #9
Sinan Erdem commentedCan you try moving the rounded corners action on top of the list? at least before defining canvas? This way it works for me. All the images with rounded corners in this website is created by using this action: http://itsme.eu/
Comment #10
asb commented@etcetera9: Thanks, I'll try that. Are you using ImageMagick or GD?
Comment #11
dman commentedTo simplify the test cases - do you still encounter the problem with the documented way to do it?
Just starting with "rounded corners" + "define canvas"
There should be no need to convert to PNG and back to JPEG during any one action, that would actually have zero effect, as internally the data is treated the same, it's only on save that the file extension is used.
You /can/ do transparency actions in memory on images originally loaded from a jpeg with GD or imagemagick pipeline, so layering & watermarks work. it's just that any 'transparent' parts get flattened on save - which is why using rounded corners to trim the image but not providing a replacement color doesn't work after saving a jpeg.
I don't know how badly the limited GD version does (in general) with imagecache actions though. I've heard of it on older systems, but don't have a server I've seen it on.
Comment #12
Sinan Erdem commentedI am using GD2 library on Ubuntu...
Comment #13
asb commentedI tried some more; GD isn't working for me at all on Debian Lenny, so that's no option - it's frightening enough that GD seems to be that much version dependent, and there are lots of hosts out there with older environments than "Lenny".
Enabled: "Imagecache Canvas Actions" and "Imagecache Color Actions", both in version 6.x-1.8. When adding a "Rounded corners" action, I'm getting a yellow message:
So there's seems to be not much point in further experiments - unless the message lies ;-/
Anyway, for argument's sake: This does not give rounded corners:
When adding a "Define Canvas" action, I'm getting another yellow message:
Nothing changes when I add a "Change File format Convert to : jpg" action as last step.
That part I don't understand. Isn't this exactly what I'm doing???
Comment #14
dman commentedis your answer then.
Someone who knows how to get that effect with ImageMagick may be able to provide more hints.
If there is an answer, it can be applied using custom_actions or http://drupal.org/project/im_raw until such time as they create a patch.
Comment #15
dman commentedI think 'define canvas' under imagemagick is working for me in 6.x-2.x-dev - my test site does it, though this support was only added earlier this year. So, it's in -dev.
But as 'rounded corners' has not been added by any imagemagick developer, then it won't help the actual task
Comment #16
asb commentedUpgraded to imagecache_actions 6.x-2.x-dev 2011-Mar-11 and tried again with this:
and this:
Same result, no rounded corners :-(
Comment #17
dman commentedComment #18
giorgoskon the latest dev of imagecache I have actually created rounded corners using just
but scale and crop is optional
Comment #19
asb commented@GiorgosK: Interesting. This works for me in preview (for the PNG Druplicon, but not with Jpegs as source images. Actually, the "Convert to: png" does not convert the file format:
Tested with imagecache_actions 6.x-2.x-dev 2011-Mar-11, imagecache 6.x-2.0-beta10 2009-Aug-19, and ImageMagick 6.3.7.
Upgraded to imagecache 6.x-2.x-dev 2011-Apr-25, exactly the same result. Great.
Comment #20
giorgoskdid you read reply #15 (imagemagick does not support rounded corners ??)
try using the GD2 instead
Comment #21
asb commentedGD what? #8
OK, there's no point to continue this; ImageMagick is not supported, and there is no workaround, so Imagecache Actions is useless on Debian, thus there is no "Do rounded corners the right way" for us 25% on Debian hosts. Closing.