Magick::Image , no size & Amazon S3

Hi,

Any ideas why I get “undefined method `size’ for 100x100 DirectClass
8-bit:Magick::Image” while doing the next?

image = Magick::Image.new(100, 100) { self.size = “100x100”}
logger.info image.size

Thanks.


This is what I’m trying to do:

I’m using the qr_image.rb to create QR codes for my app.
qr_image.rb is explained here: http://bit.ly/hCFrs1

I’m now trying to store the generated images into Amazon S3.
The upload process complains that the image has no size method. I’ve
been trying different ways to feed the image size during the creation
with no success.

This is how I use it:

@qr = RQRCode::QRCode.new(“Some text”, :size => 6)
@img = QRImage.new(@qr).sample(10)

logger.info @img.size return a noMethod error and breaks the next part

AWS::S3::S3Object.store( “#{id}.png”, @img, aBucketinS3 )

This is how I use it normally to store to file system and goes fine.

@qr = RQRCode::QRCode.new(“Some text” :size => 6)
FileUtils.mkdir_p “public/images/tags/#{ident}”
@img = QRImage.new(@qr).sample(1)
path = “public/images/tags/#{@tag.identifier}/#{ident}_thumb.png”
@img.write(path)

No help with RMagick?
Maybe someone has some good alternative to RMagick.

Cheers.

On 24 January 2011 17:12, comopasta Gr [email protected] wrote:

No help with RMagick?
Maybe someone has some good alternative to RMagick.

Please remember to quote the previous message so that the thread makes
sense.

I think you are rather optimistic hoping for a reply to your original
post within three hours. At any one time one third of the world is
asleep, one third is working and most of the rest are not interested
in RoR. Unfortunately that leaves you and me at the moment and I
don’t know about RMagik. Sorry. If you are patient someone may come
along who can help.

Colin

comopasta Gr wrote in post #977118:

Hi,

Any ideas why I get “undefined method `size’ for 100x100 DirectClass
8-bit:Magick::Image” while doing the next?

image = Magick::Image.new(100, 100) { self.size = “100x100”}
logger.info image.size

This is how I use it normally to store to file system and goes fine.

@qr = RQRCode::QRCode.new(“Some text” :size => 6)
FileUtils.mkdir_p “public/images/tags/#{ident}”
@img = QRImage.new(@qr).sample(1)
path = “public/images/tags/#{@tag.identifier}/#{ident}_thumb.png”
@img.write(path)

Well, what you’re trying to do in the top section would seem to indicate
that there isn’t a size attribute available, or the method chaining is
getting scrambled. And the second filesystem example doesn’t really say
anything about ‘size’ as you aren’t interrogating the size attribute in
that code. All that aside…

Have you tried it in irb? And perhaps

Magick::Image.new( size => ‘100x100’ )

(totally untested, and theoretical)

Colin L. wrote in post #977193:

On 24 January 2011 17:12, comopasta Gr [email protected] wrote:

No help with RMagick?
Maybe someone has some good alternative to RMagick.

Please remember to quote the previous message so that the thread makes
sense.

I think you are rather optimistic hoping for a reply to your original
post within three hours. At any one time one third of the world is
asleep, one third is working and most of the rest are not interested
in RoR. Unfortunately that leaves you and me at the moment and I
don’t know about RMagik. Sorry. If you are patient someone may come
along who can help.

Colin

Hi Colin. You are absolutely right. I shall wait :slight_smile:
Thanks for the heads up. Good to know you are around.

and most of the rest are not interested in RoR
We should do something about that also.

Cheers.