0

I am reading three images using the RMagick gem and then adding them to an ImageList

imagelist = ImageList.new

imagelist << Image.read(path1)[0]
imagelist << Image.read(path2)[0]
imagelist << Image.read(path3)[0]

Then I combined these three images with the append method

combined_image = imagelist.append(false)

Then I try to write this image to Amazon S3:

AWS::S3::S3Object.store(filename, combined_image, bucket)

However, I get this error which prevents me from successfully writing the image to S3:

undefined method `size' for #<Magick::Image:0x00000101994498>

I played around with RMagic in the console, and I found that when you append images in an ImageList, it returns an Image that seems to omit its size in bytes.

How can I modify this image so that I can write it to S3?

user730569
  • 3,940
  • 9
  • 42
  • 68

2 Answers2

1

Figured it out. The trick was to turn the combined_image to a Binary Large Object by calling to_blob on it.

user730569
  • 3,940
  • 9
  • 42
  • 68
0

I will suggest you to check whether combined_image.display shows the desired appended image to you or not. If it does, AWS::S3 must store the image file like any other general storing syntax of cloud.

kiddorails
  • 12,961
  • 2
  • 32
  • 41