Download & Extend

Resize Overlay / Watermark

Project:ImageCache Actions
Version:7.x-1.x-dev
Component:Canvas Actions Module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed

Issue Summary

Is there a way to resize an overlay image, preferably in percent of the canvas? For example I am using an alpha trans .png to vignette pictures with the imagecache action Overlay, but I would like to allow for different height images by stretching the .png to 100% x 100% of the canvas. Any ideas?

Comments

#1

If I understand what you're trying to to I think you can use the imagecache "Scale" action and click the "Allow upsizing" checkbox. This will allow you to take images that are smaller than your desired dimensions and upscale them to the correct size and allow images larger than your desired dimensions to be scaled down.

#2

Project:ImageCache» ImageCache Actions
Version:6.x-2.x-dev»

might be better to ask over in this queue.

#3

stretching images generally looks horrible.
If you want a vignette thing , perhaps imagecache_scale9 is a better result.
I don't think we'll be adding resize to overlays

#4

Status:active» closed (won't fix)

I can't see this happening.

#5

Category:support request» feature request
Status:closed (won't fix)» active

+1 for this as I'd find it very useful:

- Have an overlay resized (including upscale if that's appropriate) to fill one (preserving the aspect ratio of the overlay) or both (ignoring the aspect ratio of the overlay) of the dimensions of the target image.

Could this be an option on the canvasactions_file2canvas action?

The reason for this is that sometimes you want a single rule to watermark images of any size. Clearly when working on different images, if the overlay isn't resized to match the target this could result in a watermark that is hardly visible (watermark too small for image) or too large (watermark 'overflows' image).

#6

Version:» 6.x-1.7
Status:active» needs review

Turned out this was simple enough. Please see enclosed patch.

I added a 'Scale' checkbox to the 'Overlay (watermark)' action which is off by default (preserves original action).

This patch was made against v6.x-1.7 packaged 2010-05-25.

AttachmentSize
canvasactions.inc_.760438.patch 1.83 KB

#7

Patch #6 works for me.

When upscaling the overlay, I'd prefer to use imageapi_image_resize() (to ignore aspect ratio).

Perhaps the UI could allow a choice?

#8

Version:6.x-1.7» 6.x-1.x-dev
Component:Miscellaneous» Canvas Actions Module

Worked great for me, this actually prevents a PHP error for me when the watermark is larger than the canvas. As I don't have control over the size of the images my client uploads, this is a nice workaround/fix for me.

Error:

ImageMagick reported error code 1. Message: convert: invalid argument for option `+-6+77': -geometry. in /usr/www/sites/all/modules/imageapi/imageapi_imagemagick.module on line 235.

When I used a smaller watermark that was much smaller than the image, the positioning was off. To correct this the only thing I changed was for it to not up scale.

EG: imageapi_image_scale($overlay, $image->info['width'], $image->info['height'], FALSE);

I actually think this imageapi_image_scale() call should be the default if the overlay is larger than the image and the only option should be if it should up scale when the overlay is smaller.

#9

Version:6.x-1.x-dev» 7.x-1.x-dev

Work perfect.

But for Drupal 7 change
imageapi_image_scale($overlay, $image->info['width'], $image->info['height'], TRUE);
to
image_scale($overlay, $image->info['width'], $image->info['height'], TRUE);

#10

Chiming back in, I obviously went a different way (4 side specific overlays) for the project I was working on a couple months ago, but am happy that this issue got some love. Thanks for writing a working patch, will test as soon as I have some time outside of client work.

#11

Priority:normal» major
Status:needs review» needs work

#12

Priority:major» normal

Canvas actions and differently sized images do not cooperate nicely, certainly not when using Imagemagick. However, I think we should better support this. Certainly for image masks like blurred edges it can be expected that one wants to resize the mask first to the current image size before applying it.

Patches against the latest 7.x-1.dev are welcome and will be considered.

#13

Status:needs work» postponed

Postponing until after the 7.x-1.0 release. I don't expect to see any patch here soon that:
- will implement it for imagemagick as well.
- will implement it for both underlay and overlay.

Patches that do the above remain welcome.