# Invalid geometry string in change\_geometry

**URL:** <https://www.ruby-forum.com/t/invalid-geometry-string-in-change-geometry/92468>\
**Category:** Rails\
**Created:** [April 19, 2007, 8:33pm UTC](https://www.ruby-forum.com/t/invalid-geometry-string-in-change-geometry/92468 "2007-04-19T20:33:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joanie\_abalone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@joanie\_abalone](https://www.ruby-forum.com/u/joanie_abalone)\
**Post date:** [April 19, 2007, 8:33pm UTC](https://www.ruby-forum.com/t/invalid-geometry-string-in-change-geometry/92468/1 "2007-04-19T20:33:42Z")

</div>

I get the following error at the browser:

ArgumentError in ImagesController#upload  
invalid geometry string `110×’

… for the call to change\_geometry with an explicit size (‘110x’) as  
the geometry string:

def make\_thumb (the\_img)  
require ‘RMagick’  
size = “110x”  
debugger if ENV[‘RAILS\_ENV’] == ‘development’  
img = Magick::Image.from\_blob(the\_img.img\_data).first  
img.change\_geometry(‘110×’) {|cols, rows, i| i.resize!  
(cols,rows) }

# img.change\_geometry(“110×”) {|cols, rows, i| i.resize!

(cols,rows) }

# img.change\_geometry("#{size}") {|cols, rows, i| i.resize!

(cols,rows) }  
end

… but it all works OK when the size is buried within “#{size}”.

The debugger doesn’t seem to see any difference:

(rdb:1) l  
[112, 121] in ./script/…/config/…/app/controllers/  
images\_controller.rb  
112 def make\_thumb (the\_img)  
113 require ‘RMagick’  
114 size = “110x”  
115 debugger if ENV[‘RAILS\_ENV’] == ‘development’  
=\> 116 img = Magick::Image.from\_blob(the\_img.img\_data).first  
117 img.change\_geometry(‘110×’) {|cols, rows, i| i.resize!  
(cols,rows) }  
118 # img.change\_geometry(“110×”) {|cols, rows, i| i.resize!  
(cols,rows) }  
119 # img.change\_geometry("#{size}") {|cols, rows, i| i.resize!  
(cols,rows) }  
120 end  
121  
(rdb:1) p size  
“110x”  
(rdb:1) p (‘110×’)  
“110×”  
(rdb:1) p (“110×”)  
“110×”  
(rdb:1) p ("#{size}")  
“110x”

… and I sure don’t. Am still trying to figure out which way is up  
with much of this, and would appreciate any insight as to what’s going  
on here.

Thanks!

ps:  
ruby 1.8.5 (2006-12-04 patchlevel 2) [i386-linux]  
rails-1.2.2  
GraphicsMagick 1.1.7  
RMagick-1.15.2  
fedora core 5

---

<div class="post-metadata">

**Author:** ![joanie\_abalone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@joanie\_abalone](https://www.ruby-forum.com/u/joanie_abalone)\
**Post date:** [April 19, 2007, 8:49pm UTC](https://www.ruby-forum.com/t/invalid-geometry-string-in-change-geometry/92468/2 "2007-04-19T20:49:42Z")

</div>

On Apr 19, 2007, at 2:32 PM, joanie\_abalone wrote:

> ```
> size = "110x"
> 
> ```
> 
> … but it all works OK when the size is buried within “#{size}”.  
> =\> 116 img = Magick::Image.from\_blob(the\_img.img\_data).first  
> (rdb:1) p (‘110×’)  
> “110×”  
> (rdb:1) p (“110×”)  
> “110×”  
> (rdb:1) p (“#{size}”)  
> “110x”

I suspect you’re cut-n-pasting! Retype the literals 100x with a real  
lowercase “X” rather than the little multiplication sign that seems  
to be in there. It’s pretty obvious with the font on my system that  
they’re different.

-Rob

> RMagick-1.15.2  
> fedora core 5

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![joanie\_abalone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@joanie\_abalone](https://www.ruby-forum.com/u/joanie_abalone)\
**Post date:** [April 19, 2007, 9:28pm UTC](https://www.ruby-forum.com/t/invalid-geometry-string-in-change-geometry/92468/3 "2007-04-19T21:28:47Z")

</div>

Very Good!

Here’s a geometry string pasted into vi from the rmagick page, into  
‘foo’, versus keystroking the same string into ‘bar’

[pf@gezora imgr]$ cat foo  
“110×”

[pf@gezora imgr]$ cat bar  
“110x”

[pf@gezora imgr]$ cat foo | od -b  
0000000 042 061 061 060 303 227 042 012

[pf@gezora imgr]$ cat bar | od -b  
0000000 042 061 061 060 170 042 012 012

bar’s octal ‘170’ makes a good ‘x’ for the geometry string … foo’s  
‘303’ … not so good.

won’t do that anymore. thanks!

On Apr 19, 11:48 am, Rob B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
