What's the idea behind the encoding?  If it's that you can't/don't want to store binary data directly, you could try ASCII85/Base85 encoding, which uses 85 "printable" characters (instead of 64), and thus is slightly more compact (25% (base85) vs. 33% (base64) larger than the binary input).  Otherwise, I don't see many possibilities to significantly compress your ascii-fied image data any further, as the original JPG input already is compressed...

Note that there are several slightly different versions of ASCII85.  A CPAN search shows the related Perl module Math::Base85 which implements the RFC 1924 variant. Implementations of the Adobe variant might be found in the respective PDF/PS modules, though PDF::API2::Basic::PDF::ASCII85Decode seems to provide decoding only...

Update: FWIW, Nicholas Clark seems to have written such a module. Does anyone happen to know if/under what name that ended up on CPAN?


In reply to Re: encode/decode images by almut
in thread encode/decode images by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.