On Jul 18, 9:47 pm, John J. [email protected]
wrote:
That will probably run a lot lighter than RMagick methods, I’ll
Also if you’ll tell me which parts of the documentation are lacking
img = Image.read(‘redzigzag.jpg’)
Which apparently creates something similar to ImageList.
But when trying to use Image methods, I kept getting an error
about …private method … called for …[…]:array
(the elipses are just leaving out specifics)
What I didn’t realize I was missing was the [0] in:
img = Image.read(‘redzigzag.jpg’)[0]
I’m still not quite sure how that is working as part of that
statement really, but I know how to get it going anyway.
Because the file can contain multiple images (say, in the case of an
animated GIF or a multi-layer Photoshop image), the Image.read method
returns an array with an element for each image in the file. By adding
[0] you’re simply saying “the first image in the array.”
Perhaps I need to emphasize this more in the doc. I’ll see what I can
do.
I can certainly see the convenience of using ImageList to batch a
bunch of images, but I figured that Image was fine for working out
the logic and flow of what I want to do first.
There’s a lot of overlap between ImageList and Image. ImageList is
good if you’re working with animations or layers, otherwise it doesn’t
offer much. I hardly ever use it. I’ve often thought it would’ve been
smarter to just have one class, named Image but with the properties of
ImageList, but that’s water under the dam.
The only other truly confusing thing was lack of examples in many
method definitions. This is just me, I can “get it” faster when I
have a method definition and example with dummy data plugged in.
So do I. In fact, there are some who say that RMagick already has too
many examples, especially when they’re waiting for them to run during
the install. I look at every method to see whether it really needs
its own example, or whether it’s sufficiently similar to other methods
that someone with reasonable familiarity with RMagick can figure out
how to use it. Of course I can be wrong. Again, if you have a list of
methods that you think need an example, let me know.
BTW, the RVG stuff looks pretty interesting. I didn’t have time to
really dig deep into that so much, just skimming.
Overall, I especially like the simplicity of reading and writing
files with RMagick. I’m just glad I can do it with Ruby instead of
PHP, because Ruby is much easier for me to get a clear picture in my
mind of what I’m looking at.
Thanks for taking the time to post your impressions. If you’re really
interested in RMagick, there are a number of books that include
tutorials or recipes. I’ve posted their names on the RMagick home
page. Hal F.'s The_Ruby_Way is particularly thorough.
I hope you enjoy using RMagick!