Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a batch of SVG files with embedded, high-res PNG images. The PNG files have been resized considerably smaller (via transform, matrix, etc). What is the best way to resample these embedded images in place? The goal is to get smaller, faster-loading SVG files.

Just to clarify some terminology (emphasis added):

Resampling changes the total number of pixels in the image...

...

When you resize an image and do not resample it, you change the size of the image without changing the amount of data...

Clearly, I am only resizing the images right now.

I have toyed with trying to automate it using ImageMagick, but keeping the image proportions is not entirely trivial. Is there a simple Inkscape hack? Or something else I'm overlooking?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Inkscape does in fact have a resample option (it may be part of ImageMagick). These options are available from the Extensions -> Raster menu.

To resample items in your image:

  1. Embed the images via Extensions -> Images -> Embed Images...
  2. Select the embedded image(s)
  3. Resample via Extensions -> Raster -> Resample

enter image description here

  1. Decrease the Width and Height values to the lowest acceptable values
  2. Apply and Close

This method will work well during the authoring process. I am still working on a way to automate this and will update this post if I find a good method.

share|improve this answer
add comment

If ImageMagick did not work the way you needed, try out GraphicsMagick (homepage here). Yes, it is a fork of ImageMagick but I have at one occasion banged my head against ImageMagick because of a feature being incompletely and/or incorrectly implemented, only to find that the same feature worked like a charm (and in a way I found logical and consistent) in GraphicsMagick.

Yes, this in anecdotal evidence in the direction to try out GraphicsMagick, but it is worth a shot I think. (In general, I find ImageMagick to be a solid piece of software. It is just some cases where GraphicsMagick is more reliable and thus I stick to it.)

share|improve this answer
    
Well, I sure can't argue with your final sentence -- I just installed it and the viewer displayed the SVG when IM's version of it displayed a blank page! Thanks! Unfortunately, it doesn't help the issue of editing the graphics in place. –  zourtney Apr 21 '11 at 21:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.