0

I have a file made with a program , an image sticker maker . I know this program saves it's images(probably an image, a bg and a mask) into single file with extension ".adf" .

I couldn't convert the output file with image magick cause of below error :

convert: no decode delegate for this image format `output.adf' @ error/constitute.c/ReadImage/532.

I don't know how this Image converted with Image magick . it's my -list configure result :

Path: [built-in]

Name          Value
-------------------------------------------------------------------------------
NAME          ImageMagick

Path: configure.xml

Name          Value
-------------------------------------------------------------------------------
CC            vs10
COPYRIGHT     Copyright (C) 1999-2011 ImageMagick Studio LLC
DELEGATES     bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
FEATURES      OpenMP
HOST          Windows
LIB_VERSION   0x671
LIB_VERSION_NUMBER 6,7,1,0
NAME          ImageMagick
RELEASE_DATE  2011-07-15
VERSION       6.7.1
WEBSITE       http:// www.image magick.org

I attached the file : src.adf

* EDIT * if I run file command on src.adf it tells :

root@MexHex-PC:# file -vv src.adf
file-5.25
magic file from /etc/magic:/usr/share/misc/magic

What's missed !? Thanks

Little Elite
  • 65
  • 13
  • As far as I can tell, Imagemagick does not support a file with a suffix of .adf. That seems to be a data base file and not an image. See https://fileinfo.com/extension/adf. Furthermore, I cannot even download your file from that site. It keeps asking me to download flash, which I already have and do not trust that pop-up. I doubt that Imagemagick created that file. But your main tool might have created it independently. – fmw42 Aug 17 '18 at 15:13
  • CORRECTION. There are other image formats with the suffix .adf. See https://www.coolutils.com/Formats/ADF and https://en.wikipedia.org/wiki/Amiga_Disk_File. Your file is likely from the first link. See https://community.esri.com/thread/54775. But as far as I know, at least on my Imagemagick, it does not list that format. – fmw42 Aug 17 '18 at 15:32
  • If you are on Unix/Linux, try running `file src.adf` to see if its type can be determined. – Mark Setchell Aug 17 '18 at 15:48
  • I'm sure this file was made with Imagemagick. I had already seen that one would convert the file to tiff image. He told me to do this with Imagemagick but did not explain the method. The program's output(dalahoo3D) is also a picture in a mask that can be cut with a laser to create a three-dimensional stick for sticking to the wall. I guess this extension(adf) is an irrelevant name! – Little Elite Aug 17 '18 at 15:48
  • @Mark Setchell it said it's a some kind of Binary-octet stream ! – Little Elite Aug 17 '18 at 15:50
  • 1
    *"Binary octet stream"* means *"load of unrecognised stuff"*! Try running `strings src.adf | more` and see if there are any recognisable english words in it. – Mark Setchell Aug 17 '18 at 15:53
  • @MarkSetchell I think the only meaningful name is 'JFIF'. – Little Elite Aug 17 '18 at 15:59
  • It looks like 2 header repeats are found in the entire file(with JFIF part). It seems that two files are put together in one file. – Little Elite Aug 17 '18 at 16:11
  • @MarkSetchell please look at the result of the ''file command" I added above. not interesting ? – Little Elite Aug 17 '18 at 16:20

1 Answers1

3

This src.adf looks like a very minimal & flat data file. I know nothing about Dalahoo3D and/or ArcGis products, but we can quickly extract the embedded images with python.

import struct

with open('src.adf', 'rb') as f:
    # Calculate file size.
    f.seek(0, 2)
    total_bytes = f.tell()
    # Rewind to beging.
    f.seek(0)
    file_cursor = f.tell()
    image_cursor = 0

    while file_cursor < total_bytes:
        # Can for start of JPEG.
        if f.read(1) == b"\xFF":
            if f.read(3) == b"\xD8\xFF\xE0":
                print("JPEG FOUND!")
                # Backup and find the size of the image
                f.seek(-8, 1)
                payload_size = struct.unpack('<I', f.read(4))[0]
                # Write image to disk
                d_filename = 'image{0}.jpeg'.format(image_cursor)
                with open(d_filename, 'wb') as d:
                    d.write(f.read(payload_size))
                image_cursor += 1
            else:
                f.seek(-3, 1)  # Back cursor up, and try again.
        file_cursor = f.tell()

Which dumps the following three images...

image0

image1

image2

I'm sure this file was made with Imagemagick. I had already seen that one would convert the file to tiff image. He told me to do this with Imagemagick but did not explain the method.

I'm guessing this is just a matter of miscommunication. It's true that ImageMagick commonly handles JPEG / TIFF formats, but not geographic information systems and/or 3D modeling. That's usually extended by a vendor -- like ArcGIS. I would bet that ImageMagick is present in the workflow of generating TIFF files, but .ADF wouldn't be supported by ImageMagick until someone writes a delegate coder.

Update

From this question, it looks like you'll need to extend ImageMagick delegates to call GDAL utilities. You'll need to update the delegates.xml file to call the correct utility.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
emcconville
  • 23,800
  • 4
  • 50
  • 66
  • `@emcconville`. Nice analysis! – fmw42 Aug 17 '18 at 21:56
  • @emcconville It was really cool ! Can you explain to me how you got this solution That how these bytes should solve the problem ? – Little Elite Aug 18 '18 at 04:39
  • @emcconville It looks like it does not find one of the images (probably the last image)! Where should the code change? – Little Elite Aug 18 '18 at 05:17
  • I created this solution be evaluating the data stream, and recognizing data structures. Techniques differ between professionals, but a common task. As for the missing image, I only see 3 JPEGs, what are you expecting? Perhaps a vector clip mast, or something else? – emcconville Aug 18 '18 at 14:06
  • I used your script on a file that had 5 pictures of girls in it. I got only 4 of them ! the last picture seems to be ignored ! try this and see the result ! https://files.fm/f/rvwq39ed – Little Elite Aug 20 '18 at 10:02
  • 1
    Try the updated python-code. It's possible for the preceding LSB integer to fail the JPEG signature. – emcconville Aug 20 '18 at 13:15
  • Thanks man. it works like a charm. I would like to read about this amazing techniques, you helped me a lot. – Little Elite Aug 21 '18 at 04:40