Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

vector density on read #25

Open
hynkle opened this Issue · 2 comments

2 participants

@hynkle

I'm trying to convert a vector image to a raster image of a larger size, let's say 4x larger. Suppose just running convert img.svg img.png gives you a 100x100 image.

With ImageMagick's convert command, the conversion with enlargement would look like:

convert -density 288 img.svg img.png

Where 288 is of course 4x the default density of 72. And that works beautifully, resulting in the desired 400x400 image without the ugly artifacts you'd get from upsampling a 100x100 raster image to 400x400 (which is indeed why I'm using a vector image for the original in the first place).

But what I would have thought was the corresponding RMagick code:

image = Magick::Image.read('img.svg'){self.density = 144}.first
image.write('img.png')

... results in the same 100x100 image you'd get by just running convert img.svg img.png. Moreover, the image reports its density as "72x72" as though I hadn't supplied anything in read's block.

Am I simply approaching this problem wrong, or this a bug?

@gucki

I'm having exactly the same problem. Have you already been able to solve/ workaround it? :)

@gucki

I just now I found that this code works perfectly fine for me:

Magick::Image.read(filename) { self.density = "300x300" }.first

My fault was to not the the density on reading but later on, which does not work.

@bf4 bf4 referenced this issue in gemhome/rmagick
Closed

vector density on read #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.