I'm attempting to display images that are partially desaturated, ie they still have a little color. To do this, I first desaturate, then overlay the source to the canvas with opacity at 25% and no offset. Finally the result is scaled and cropped to 1024 x 512.

Using GD toolkit, I'm finding that derivatives of 3-5MB images are taking an age (1-2 minutes each) to generate, with a "service unavailable" (503) server error for the derivative path while they are being generated. These derivatives will get used in a homepage slideshow, so I really can't use the action as-is.

Is this sort of processing time to be expected for the "overlay source to canvas" action?

Comments

fietserwin’s picture

GD does indeed not have such an effect so this effect is implemented as a double loop over all pixels and involves quite some computations per pixel.

What you could do:

  • Switch to ImageMagick
  • Speed up the GD processing by first resizing. However, the "overlay image: source to canvas" does not have a scale option to resize the overlaid source (nor do watermark, underlay, and image mask). So to get this to work, you would need to add a scale option (we are interested in adding that) or have the images resized on upload, which is feasible if they are only used via this image style. if you need the larger originals elsewhere, this might not be possible.

HTH

dman’s picture

Yeah, right from the beginning, any transparency effects were extremely expensive to produce in GD. There used to be dire warnings on the alpha-action settings form about that. There is a huge performance difference between being able to use the GD binary library effects, and running the handmade pixel processes in PHP.

fietserwins suggestions are correct - you can even do both.

John Pitcairn’s picture

Thanks - I like to keep the original images around, they tend to become the only copy when the client misplaces their original, so scaling on upload is not ideal. I'll look into ImageMagick first.

John Pitcairn’s picture

Title: Huge processing time (503 error) with desaturate and overlay source to canvas » Huge processing time (503 error) with overlay source to canvas

OK, using ImageMagick, there appears to be a problem with the "overlay source to canvas" action - the convert binary isn't being given the correct path to the source. I get this log error:

error: ImageMagick error 1: convert: unable to open image `//images/deck_r-6359.jpg

If I remove the "overlay source to canvas" action and just desaturate then scale and crop, I see no errors.

John Pitcairn’s picture

Looks like this is a bug in image_imagemagick_overlay(). If I patch that, the image generation works and is a lot faster than using GD.

Filing a separate issue: #2379359: image_imagemagick_overlay() passes a stream wrapper to convert

fietserwin’s picture

Status: Active » Closed (works as designed)

Closing this issue, assuming the OP has seen his question answered. If not, feel free to reopen, stating what your remaining questions are.