Imported Upstream version 2.0.1

parents
Beginning with version 1.2.6, exifprobe reports the structure of
Print Image Matching sections, according to information provided by
evan@ozhiker.com on the web page at
http://www.ozhiker.com/electronics/pjmt/jpeg_info/pim.html
The meaning of the PIM tags and the interpretation of the 4 bytes
of data in each entry are not known. Exifprobe prints the tags by
hexadecimal number, and prints the data in two formats: a "hex dump"
of each data entry, followed by the hex and decimal values of the data
interpreted as unsigned long integers in the prevailing byteorder of the
Exif data.
Print IM is a feature of Epson Printers, supported by several camera
manufacturers. The PrintIM section is included in either the first TIFF
IFD or in the MakerNote, or both. The section records a "profile"
indicating certain transformations which the manufacturer finds will
improve the image presentation on a PrintIM-enabled printer. Epson
provides a FAQ at
http://www.printimagematching.com/faq4.php
which better describes Print Image Matching.
According to the FAQ, the values provided in the PrintIM section may
include:
Gamma Level
Color Space
Color Balance
Contrast
Brightness
Sharpness
Saturation
Shadow
Highlight
PIM version II also may include
Noise Reduction
Custom Scene setting
This diff is collapsed.
2.0.1:
The following changes have been made since version 2.0.0:
General code cleanup and bug-fixes for variables which could be
used before being set.
Fixed some missing 'break' statements in 'default' branches of several
switch statements in print_filetype(). These apparently caused gcc
3.4.3 to abort under Linux.
Updates to Minolta MakerNotes for A1 and A2 models, contributed by
Stanislav Brabec. Also added an identifier for the DiMAGE 5, and
updated the CamerSettings ImageSize. Now catches and flags the
'count' bug in the 'ImageByteSize' makernote tag, rather than
printing spurious multiple values at the ImageByteSize value used
as an offset.
In jp2000.c, 'mark' characters for file offsets were inconsistent.
Now '@' is used for all box tags, and '=' for untagged entries.
Also added a missing initialization for 'max_offset' in process_jp2_de().
APP sections and image data was omitted from output in LIST mode;
now printed as 'pseudo-tags' in "@offset:length" format. Also
print_offset_makervalue() was not printing @offset:length for
UNDEFINED sections in REPORT mode.
All 'pseudo-tags' are now marked with '*' in the address field
(these only appear in LIST mode, where the address field is not
enabled by default).
'Tiled' jpeg images included in tiff IFDs can be compressed
tile-by-tile. This has been seen in a few DNG images. It caused
report of "early EOI" when the first tile EOI was found, and the
remaining tiles ignored. The program now expands the first and
last tile, with just tile numbers in between.
The TIFF 'XML' tag now has a name.
In main(), the file close was handled outside check for null file
pointer, and would cause a core dump if no file was open. I hate
it when that happens.
ExposureInfo was not printed in CIFF directories due to an hidden
'break' statement which caused the following code to be ignored.
Also in CIFF, some directory entries would print with empty values
in REPORT mode if no option was selected for output format of
offsets. Now defaults to decimal offset.
=================================================================
2.0.0:
The following changes have been made since version 1.2.6:
Support has been added for several "raw" camera file/image formats:
MRW,CIFF/CRW,X3F,RAF,JP2/JPEG2000,DNG,CR2,NEF,ORF,PEF,KDC,K25,
and TIFF and JPEG support has been improved and generalized. In
particular, TIFF routines have fewer expectations that interfere with
handling of derived formats, and more information is extracted from
JPEG markers.
Image summaries have been improved and are now provided for all
supported formats (not just TIFF). The new summary scheme avoids
problems which occurred in TIFF summaries when IFD chains were longer
than two IFDs. Summary entries are provided for all sub-images found in
the file.
Subtle and not-so-subtle improvements have been made in program output.
All image sections (not just JPEG) are now reported "in place" with a
brief hex dump of the beginning of data, and an option to dump more.
More checks and alerts about "suspicious" file format elements are
provided, e.g reports of JPEG_EOI found before the announced end of the
section. LIST mode output now uses "long names" consisting of the
entire list of parent sections of the current tag, separated by dots.
This is more informative, and necessary to avoid duplicate names, but
may require post-processing if the output is consumed by a script (most
shells don't allow '.' in variable names). Short names in list mode are
typically not useful (but suit yourself). Long names can be enabled in
structural mode, if you like that sort of thing.
Bug fixes:
The program is now prepared to handle image summaries for chained
TIFF IFDs of any length. Chained IFDs have always been handled, but
the image summary mechanism was not prepared to handle chains longer
than the 'usual' 2 IFDs. Thumbnails found in the first two IFDs would
not be "forgotten" when processing later IFDs and would be reported
repeatedly; confused data would appear in the summary. The mechanism
would report only JPEG thumbnails and image blobs found in TIFF IFDs.
The new summary mechanism displays and records all image sections
found, in all supported file formats, and reports useful (and usually
more accurate) summary information about each at the end of processing,
including a count of images found and where they are located.
Expanded MakerNote coverage:
Much new data, particularly for Olympus (more tags, MakerNote subifds,
etc), and Nikon (including preview subifd). Most of the new information
is taken from Phil Harvey's 'ExifTool' web pages at
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/index.html
Improved MakerNote handling:
The program now defines "noteversions" for makers that use multiple
versions, and will attempt to choose the correct version for
unknown models. Canon CustomFunctions have been fixed so that D30
CustomFunctions, previously displayed for all models containing
CustomFunctions tags, are now displayed only for D30, with additional
noteversions for some additional models. An unrecognized Canon model
with the CustomFunctions tag will display only the contents, with no
attempt at interpretation.
New options:
Several new options have been added (see the manual page);
-B len|a print 'len' (or all) bytes of binary image
data or failed JPEG data
-C [make]+[model] print known makes and models
-n print filename on each line of output
(toggle)
-pl print long names (default for LIST mode)
(toggle)
-t disable color by default if output is not
to a tty (effective ONLY if set in
EXIFPROBE_OPTIONS)
-O offset start processing at 'offset'
-N noteversion force use of MakerNote version 'noteversion'
[a maker-specific number]
-u print raw 'unicode' data. Default output
assumes data labeled as 'UNICODE' is really
ascii in a bigger box, and prints just the
low bytes. This option enables raw printing
of both bytes (no translations attempted).
(toggle)
Auxilliary programs:
Some crude but sometimes useful auxiliary programs are now
included with the distribution.
extract_section - extracts a section of a file given start offset
and length, or start and end offset (which you
can get from exifprobe output). An easy way to
extract embedded JPEGs.
findjpeg - scan a file for valid jpeg streams. VERY crude,
and not useful on mostly binary files.
dump_section - print a specified chunk of a file as bytes,
shorts, longs, or short or long rationals.
probetohtml - a simple shell script which uses 'sed' to convert
color escape sequences to font color tags and
generate an HTML file for the output of exifprobe.
reformat.sh - script to reformat LIST output to change dots to
underscores, remove comments, etc. to make the
output acceptable to a shell for sourcing. The
'-var' and '-export' options of exifgrep are no
longer adequate for that purpose.
convert_rgb_to_tiff - convert the RGB section of a Canon CR2 file to
a 384x256 TIFF image that anybody can see.
Uses ImageMagick 'convert' utility on extracted
d.ata
convert_rgb_to_jpeg - convert the RGB section of a Canon CR2 file to
a 384x256 JPEG image that anybody can see.
Uses ImageMagick 'convert' utility on extracted
data.
Most of the MakerNote information in the exifprobe code is taken from
documents posted to the web by the people listed below. If errors exist,
they are likely due to transription errors on my part, or to additions I
have made after examining a few images (notify me at dhh@virutal-cafe.com).
If I've missed a proper attribution, please let me know about that, too.
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Nikon, Fujitsu (Fujifilm), Olympus */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
TsuruZoh Tachibanaya at:
http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
The Nikon E990 data in that document is attributed to Max Lyons,
and may also be found at:
http://www.tawbaware.com/990exif.htm
Additonal tags for later Nikons (specifically E5700) from web page by
Johannes Tschebisch at:
http://www.jojotsch.de/
The Casio information in that document is attributed to Eckhard Henkel:
(see Dicasoft below)
The Olympus information in that document is attributed to Peter Esherick.
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Canon */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
David Burren at:
http://www.burren.cx/david/canon.html
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Casio (older models) */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
Dicasoft:
http://www.dicasoft.de/casiomn.htm
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Sanyo */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
John Hawkins at:
http://www.exif.org/makernotes/SanyoMakerNote.html
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Minolta DiMAGE 5, 7*, S304, S404, S414, F300 */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
Dalibor Jelinek at:
http://www.dalibor.cz/minolta/makernote.htm
Upates for A1, A2 by Stanislav Brabec
http://www.penguin.cz/~utx
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Panasonic */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
Tom Hughes
tom@compton.nu
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Sigma/Foveon (NOTE: manufacturer data!) */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
http://www.x3f.info/technotes/FileDocs/MakerNoteDoc.html
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* PrintIM structure, Asahi makernotes, latest Casio notes */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
evan@ozhiker.com
http://www.ozhiker.com/electronics/pjmt/jpeg_info/pim.html
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* April, 2005: Olympus, Nikon, Canon, Asahi updates; some CIFF info */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
Phil Harvey (author of 'exiftool') at:
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/index.html
Exifprobe reads image files produced by digital cameras (including
several so-called "raw" file formats) and reports the structure of
the files and the auxilliary data and metadata contained within them.
In addition to TIFF, JPEG, and EXIF, the program understands several
formats which may contain "raw" camera data, including MRW, CIFF/CRW,
JP2/JPEG2000, RAF, and X3F, as well as most most TIFF-derived "raw"
formats, including DNG, ORF, CR2, NEF, K25/KDC/DCR, and PEF.
MakerNote sections found in Exif IFDs are reported and expanded if the
note is in a semblance of TIFF IFD format. Information which has been
published on the internet is used to interpret notes where possible.
The default output attempts to describe the structure of the file,
showing location, size and content of auxilliary data, metadata, and
image sections. Multiple images contained in a single file are noted
(and JPEG sub-image markers examined for useful data). A summary of
images found is printed at the end of output for each file.
Many options are provided for detail control of output format.
For convenience, two pre-set formats (in addition to the default
'structural' format) are provided: a "report" format (which shows
"structure" of TIFF ifds, but with values printed inline), and a
"list" format which eliminates structural elements and presents data
in a human (or script) readable format for possible use in gallery
applications.
# @(#) $Id: INSTALLING,v 1.8 2005/06/30 17:51:42 alex Exp $
The program should compile on any reasonably modern Unix or Linux
system, but has been tested only on FreeBSD and RedHat Linux. No
extra libraries are required. If you compile on other systems,
please let me know. I have deliberately attempted to avoid the
need for massive "autoconfuse" scripts, but time will tell.
For FreeBSD and Linux, it should be sufficient to just type 'make'
unless you wish to change defaults for CFLAGS (see below). On
some systems you may need 'gmake' (or edit the PREFIX line to
something your make will accept).
If your system does not have a system include file "endian.h"
which defines BYTE_ORDER (or __BYTE_ORDER) as LITTLE-something or
BIG-something, you may need to fix the file "makebyteorder.sh",
or manually create a file "byteorder.h" in the distribution
directory. If your machine's native byte order is big-endian,
add the single line:
#define NATIVE_BYTEORDER_BIGENDIAN
The sources assume little-endian unless told otherwise,
so an empty "byteorder.h" is sufficient in that case.
Check CFLAGS:
If your system includes provide the type 'uint32_t' in types.h
but not 'u_int32_t' (Solaris), uncomment the line which defines
uint32_t (or add the definition to CFLAGS). BSD and Linux define
u_int32_t in sys/types.h, which is where this code expects it.
If you do NOT want support for ANSI color sequences to emphasize
certain sections of the output, remove
-DCOLOR
Alternatively, if you want color but find my selections bilious,
you can change a few defines in defs.h. The colors currently
used are intended to be used with a light background; I don't
recommend them with 'reverse-video' or otherwise dark backgrounds.
If you want color compiled in, but don't want it by default (the
'-c' flag toggles color if support is compiled in) edit defs.h to
remove the PRINT_COLOR bit from PRINT_DEFAULTS.
Check PREFIX, BINDIR and MANDIR: set to the directories where the executable
and manual page should be copied. Normally, you will only need to set
PREFIX.
Then do
(optional) make depend (requires the executable 'makedepend')
make
and when you're ready
make install
The files in the 'aux" directory must be compiled and/or installed
manually. There is a simple Makefile for the C programs. You may
want to modify the scripts for your own purposes.
Duane Hesser
dhh@virtual-cafe.com
http://virtual-cafe.com/~dhh/tools.d/software.html
# @(#) $Id: LICENSE.EXIFPROBE,v 1.5 2005/01/30 17:15:57 alex Exp $
All of the files included in the EXIFPROBE distribution are:
Copyright (C) 2005 by Duane H. Hesser. All rights reserved.
Some individual files may be covered by other copyrights.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Author: dhh@virtual-cafe.com <Duane H. Hesser>
# @(#) $Id: MAKER_NOTES,v 1.8 2005/07/05 17:02:24 alex Exp $
Only one camera maker (Foveon, for the Sigma/Foveon camera) currently
publishes the form or interpretation of their makernote data; the data is
apparently recorded just to make the image file larger.
Exifprobe's identification and interpretation of tags in MakerNotes is
based largely upon information reverse-engineered by others and posted to
the Web (see CREDITS). A few items are based upon examination of images
downloaded from websites whose operators are kind enough to make camera
images available for download (including some rather *large* images).
I recommend that you examine any output for your camera to assure yourself
that the associations between tag identifiers and the interpretation of
the associated values is reasonable and correct. Please report to me
(dhh@virtual-cafe.com) any corrections you think should be made for any
make or model of camera, and any additional information you may deduce for
any camera (or other device).
It should be noted that tag numbers, types, and values shown by exifprobe
will be correct if shown...they are read directly from the image file. It
is the "interpretation" of tags and associated values which could be
suspect.
The strategy used by exifprobe to read MakerNotes does *not* depend upon a
table of makes and models. The program scans the offset given for the note
to see if it can find an ID string, a TIFF header, and/or a valid IFD entry
or two at a reasonable offset and in either byteorder. The features it
finds are recorded as a "scheme" which is used for reading and printing the
MakerNote information. If a valid IFD is found the program consults make
and model information for the oddball variations used by some manufacturers
(e.g. offsets relative to the start of the note or start of each entry) and
to see if tagnames and value interpretations are available. If tagnames and
interpretations are not available, the program will print the raw data with
tagnames constructed from the tag number.
dhh@virtual-cafe.com
# @(#) $Id: Makefile,v 1.33 2005/07/25 19:41:06 alex Exp $
# Makefile for EXIFPROBE image file probe
# Any compiler should do
CC=cc
CFLAGS=-DCOLOR -O
# You probably don't need these
# CFLAGS=-DCOLOR -g -O -Dlint -Wall -Wno-long-long
# SPLINTCFLAGS=-DCOLOR -Dlint -showsummary
# If your system has strcasestr(3) you can use this if you like.
# If not defined a fake routine is used (which should be good enough,
# this is used only for the -C option)
# CFLAGS+=-DSTRCASESTR=strcasestr
#Solaris; cultural differences
#CFLAGS += -Du_int32_t=uint32_t
# You'll need this on big-endian machines if (and ONLY if) "byteorder.h"
# is not created properly on first invocation.
#CFLAGS += -DNATIVE_BYTEORDER_BIGENDIAN # or add to ./byteorder.h
# On Solaris, you may need to use 'gmake', or edit the next line.
PREFIX ?= /usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/man/man1
INCLUDES=defs.h extern.h misc.h tifftags.h exiftags.h \
tiffeptags.h jpegtags.h global.h
MAKERSRCS=maker_nikon.c maker_epson.c maker_olympus.c maker_fujifilm.c \
maker_casio.c maker_minolta.c maker_sanyo.c maker_canon.c \
maker_leica.c maker_agfa.c maker_asahi.c maker_panasonic.c \
maker_kyocera.c maker_toshiba.c maker_sigma.c maker_sony.c \
maker_konica.c maker_hp.c maker_kodak.c maker_ricoh.c \
maker_traveler.c
MAKEROBJS=maker_nikon.o maker_epson.o maker_olympus.o maker_fujifilm.o \
maker_casio.o maker_minolta.o maker_sanyo.o maker_canon.o \
maker_leica.o maker_agfa.o maker_asahi.o maker_panasonic.o \
maker_kyocera.o maker_toshiba.o maker_sigma.o maker_sony.o \
maker_konica.o maker_hp.o maker_kodak.o maker_ricoh.o \
maker_traveler.o
SRCS=main.c readfile.c print.c tagnames.c process.c misc.c interpret.c \
print_maker.c maker_generic.c maker_tagnames.c options.c ciff.c\
jp2000.c mrw.c raf.c x3f.c \
$(MAKERSRCS)
OBJS=main.o readfile.o print.o tagnames.o process.o misc.o interpret.o \
print_maker.o maker_generic.o maker_tagnames.o options.o ciff.o \
jp2000.o mrw.o veclib.o raf.o x3f.o \
$(MAKEROBJS)
all: byteorder.h exifprobe
byteorder.h:
@echo -n "Creating byteorder.h: "
@sh makebyteorder.sh
@cat byteorder.h
@echo
veclib.o: lib/veclib.c
$(CC) -o veclib.o -c $(CFLAGS) lib/veclib.c
# Need the math library to calculate some APEX things...
exifprobe: $(OBJS) $(INCLUDES) Makefile
./mkcomptime > comptime.c
$(CC) -o exifprobe $(CFLAGS) $(OBJS) comptime.c -lm
install: all
cp exifprobe $(BINDIR)
cp exifgrep $(BINDIR)
cp exifprobe.1 $(MANDIR)
cp exifgrep.1 $(MANDIR)
# if you want HTML man pages, pick a target; I prefer man2html
rman: exifprobe.1 exifgrep.1
# edit at <blockquote> & APP0...APPn; rman gets it wrong
rman -f HTML exifprobe.1 > exifprobe-rman.html
rman -f HTML exifgrep.1 > exifgrep-rman.html
man: exifprobe.1 exifgrep.1
groff -man -Thtml exifprobe.1 > exifprobe-man.html
groff -man -Thtml exifgrep.1 > exifgrep-man.html
man2html:
nroff -man exifprobe.1 | man2html -pgsize 1024 -topm 0 -botm 2 -noheads > exifprobe.1.html
nroff -man exifgrep.1 | man2html -pgsize 1024 -topm 0 -botm 2 -noheads > exifgrep.1.html
clean:
rm -f exifprobe *.o comptime.c
distclean: clean undepend
rm -f byteorder.h MANIFEST.* Makefile.bak exifprobe-*.tar.gz
depend: byteorder.h
makedepend -- $(CFLAGS) -- $(SRCS)
undepend:
makedepend
splint: $(SRCS) $(INCLUDES) Makefile
splint $(SPLINTCFLAGS) $(SRCS)
# DO NOT DELETE THIS LINE -- make depend depends on it.
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* EXIFPROBE - TIFF/JPEG/EXIF image file probe */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Copyright (C) 2002 by Duane H. Hesser. All rights reserved. */
/* */
/* See the file LICENSE.EXIFPROBE for terms of use. */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* @(#) $Id: agfa_datadefs.h,v 1.1 2005/05/25 15:38:07 alex Exp $" */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
#ifndef AGFA_DATADEFS_INCLUDED
#define AGFA_DATADEFS_INCLUDED
#include "maker_datadefs.h"
struct camera_id agfa_model_id[] = {
{ "SR841", 6, AGFA_SR841, 1, 1 },
{ 0, 0, 0, 0, 0 }
};
#endif /* AGFA_DATADEFS_INCLUDED */
all: extract_section dump_section findjpeg
extract_section: extract_section.c
${CC} -o extract_section extract_section.c
dump_section: dump_section.c
${CC} -o dump_section dump_section.c
findjpeg: findjpeg.c
${CC} -o findjpeg findjpeg.c
extract_section: extract_section.c
${CC} -o extract_section extract_section.c
clean:
rm -f extract_section dump_section findjpeg
These programs are rather crude but may be useful.
extract_section - extracts a section of a file given start offset
and length, or start and end offset (which you
can get from exifprobe output). An easy way to
extract embedded JPEGs.
findjpeg - scan a file for valid jpeg streams. VERY crude,
and not useful on mostly binary files.
dump_section - print a specified chunk of a file as bytes,
shorts, longs, or short or long rationals.
probetohtml - a simple shell script which uses 'sed' to convert
color escape sequences to font color tags and
generate an HTML file for the output of exifprobe.
reformat.sh - script to reformat LIST output to change dots to
underscores, remove comments, etc. to make the
output acceptable to a shell for sourcine. The
'-var' and '-export' options of exifgrep are no
longer adequate for that purpose.
convert_rgb_to_tiff - convert the RGB section of a Canon CR2 file to
a 384x256 TIFF image that anybody can see.
Uses ImageMagick 'convert' utility.
convert_rgb_to_jpeg - convert the RGB section of a Canon CR2 file to
a 384x256 JPEG image that anybody can see.
Uses ImageMagick 'convert' utility.
#!/bin/sh
# Converts the RGB blob extracted from a Canon CR2 file to a displayable JPEG image.
# Extract the section with 'exifgrep Ifd2.Strip filename', then
# 'extract_section @StripOffsets:StripByteCounts'
# Rename the file to have an 'rgb' extension, then run this using the basename of the
# rgb file as argument.
# ...or write a better script to automate the process.
convert -verbose -size 384x256 -depth 8 -gamma 2.2 -density 72x72 $1.rgb'[384x256]' $1.jpg
#!/bin/sh
# Converts the RGB blob extracted from a Canon CR2 file to a displayable TIFF image.
# Extract the section with 'exifgrep Ifd2.Strip filename', then
# 'extract_section @StripOffsets:StripByteCounts'
# Rename the file to have an 'rgb' extension, then run this using the basename of the
# rgb file as argument.
# ...or write a better script to automate the process.
convert -verbose -size 384x256 -depth 8 -gamma 2.2 -density 72x72 $1.rgb'[384x256]' $1.tif
This diff is collapsed.
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* Copyright (C) 2002,2005 by Duane H. Hesser. All rights reserved. */
/* */
/* See the file LICENSE.EXIFPROBE for terms of use. */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
/* This program extracts an arbitrary section of a file from */
/* 'start_offset' to 'end_offset', writing it to a file named with */
/* the original filename suffixed by ".%d-%d" start,end. */
/* section to be extracted may be specified by a second argument */
/* "@start:length" or by second and third arguments "start end". */
/* This is intended to extract sections from image files, and is much */
/* faster than 'dd' for the purpose. */
#ifndef lint
static char *ModuleId = "@(#) $Id: extract_section.c,v 1.1 2005/06/30 17:50:27 alex Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <values.h>
#define END_OF_FILE MAXINT
#define COPYBUFSIZE 16384
#define NAMELENGTH 1024
extern char *optarg;
char *Progname;
main(int argc,char **argv)
{
char copybuf[COPYBUFSIZE];
char outfilename[NAMELENGTH];
char *arg,*infilename,*colon;
unsigned long start_offset = 0UL;
unsigned long end_offset = END_OF_FILE;
int opt;
FILE *ifp,*ofp;
int readsize = 0;
int bytesread = 0;
int byteswritten = 0;
int bytescopied = 0;
int sizeleft = 0;
int onamelength = 0;
Progname = *argv;
if(argc >= 2)
{
infilename = *++argv;
arg = *++argv;
if(arg && (*arg == '@'))
{
start_offset = strtoul(++arg,(char **)0,0);
colon = strchr(arg,':');
if(colon)
end_offset = start_offset + strtoul(++colon,(char **)0,0) - 1;
}
else if(arg)
{
start_offset = strtoul(arg,(char **)0,0);
if(*++argv)
{
arg = *argv;
end_offset = strtoul(arg,(char **)0,0);
}
}
}
if(infilename)
{
if(end_offset == END_OF_FILE)
onamelength = snprintf(outfilename,NAMELENGTH,"%s.%d-eof",infilename,start_offset);
else
onamelength = snprintf(outfilename,NAMELENGTH,"%s.%d-%d",infilename,start_offset,end_offset);
if(onamelength < (strlen(infilename) + 2))
{
fprintf(stderr,"%s: can't make output name",Progname);
perror("\tbecause");
exit(2);
}
}
else