sprite-factory icon indicating copy to clipboard operation
sprite-factory copied to clipboard

`width` `height` options is not working

Open Julyyq opened this issue 9 years ago • 0 comments

I have 2 source images with 500x500 size, and I want to fix the width and height of each sprite images to 100, but get the following error:

image test1 does not fit within a fixed width of 100 (RuntimeError)

Seems this options is not working as expect.

I check the source code of this very useful library, found the error comes from here:

images.each do |i|
  i[:name], i[:ext] = map_image_filename(i[:filename], input_path)
  raise RuntimeError, "image #{i[:name]} does not fit within a fixed width of #{width}" if width && (width < i[:width])
  raise RuntimeError, "image #{i[:name]} does not fit within a fixed height of #{height}" if height && (height < i[:height])
end

Only if the options's width or height is less than the width or height of the image, this error occurs, the correct logic maybe is more than .

So, I try to change the < to >, the generated sprites size is then correct, but the source image size is clipped but not stretched. Is this a bug?

Julyyq avatar Jun 08 '15 08:06 Julyyq