image to blob to file ::then:: file to blob to image :: is this possible? why so hard to figure out?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ss.private
Posts: 3
Joined: 2019-09-14T14:41:56-07:00
Authentication code: 1152

image to blob to file ::then:: file to blob to image :: is this possible? why so hard to figure out?

Post by ss.private »

Hi,
Old hand at development here, but newbie to image-magick.
Just BTW, right now I am in strawberry perl (v28) on Win10.

Code: Select all

use strict;
use warnings;
use Image::Magick;
magick -version
Version: ImageMagick 7.0.8-59 Q16 x64 2019-08-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenCL OpenMP(2.0)
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib
All that said, what I need to do is store images in an relatively unreadable or at least serious pain-in-the-neck form -- without encryption. I am figuring so far that IM blobs ought to fit the bill.(I have not yet started fighting with "authentic pixels", though I guess that's my next, unpromising, step.)

So far I can create the images I need. They look fine. I can write them out as PNG files. Those are fine too. And in pursuit of my real goal, I use ImageToBlob to get at the insides, and then I write that out to yaddayada.blob. No prob.

When I read the blob files back in and try to convert them back to PNG images that I could display or send them over the wire for somebody else's code to display, or even persist to disk somewhere, I find my self in MAGICK HELL. (cue drums and booga booga noises, bwa hah hah etc.)

I haven't included a code sample here because I've done just about every permutation of

Code: Select all

new, read, blobtoimage
and whatnot that I can think of, and I keep getting:
Exception 410: no images defined `Image::Magick' @ error/Magick.xs/unknown/14276] from image->Write to somedumbfilename.png
A few lines of working code or even a good hint where to find an answer will get you my most profound and lasting gratitude -- and free beer if you're ever in my neighborhood.

In any case, Thank you for reading this far.

Best,
SS
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: image to blob to file ::then:: file to blob to image :: is this possible? why so hard to figure out?

Post by fmw42 »

Have you considered using MIFF format, which only ImageMagick uses. Or INLINE: format, which is base64 text. See https://imagemagick.org/Usage/files/#special_formats
ss.private
Posts: 3
Joined: 2019-09-14T14:41:56-07:00
Authentication code: 1152

Re: image to blob to file ::then:: file to blob to image :: is this possible? why so hard to figure out?

Post by ss.private »

Oh, just another bit of diabolical torment, IrfanView can figure out that my .blob files are PNG's with the wrong extension and display them. BUT if I concatenate my blobs into a single file, and then later read those chunks back out and record them as single files, Irfanview has no idea what they are, nor gimp, nor DarkTable.

This is double-dang confusticating!
ss.private
Posts: 3
Joined: 2019-09-14T14:41:56-07:00
Authentication code: 1152

Re: image to blob to file ::then:: file to blob to image :: is this possible? why so hard to figure out?

Post by ss.private »

@ fmw42 THX a million. will try that rright now,
fingers crossed.
SS
Post Reply