I'm trying to write a module which turns images into data.
I would have all my methods receive input in the form of raw data (refs), say 32bit. You do not need any of Magick's or GD's functionality (drawing boxes, writing text onto image etc.) so why have your methods demand Magick or GD object as input? As a convenience to the API user, you could supply a static method to convert a Magick or GD object into the raw data (refs) type your methods require (something like the factory methods some fellow monk mentioned).
But then, if the user already converted their image into 32bit raw data for input to your module's methods, you have little more to do than saving it into a file. Unless your aim is to provide data transformation/validation as well. If that's what you are after then ask for input in a common format, e.g. 32bit pixel data and start your module on this assumption. Much more productive than having to deal with Magick's or GD's internal formats. The biggest disadvantage is that getting a *reference* to image data from those objects may not be possible and your user may have to duplicate data ...
bw, bliako, (swimming) under Poseidon's temple
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||