--- parser3/src/classes/image.C 2002/11/28 12:23:39 1.87 +++ parser3/src/classes/image.C 2003/02/04 14:04:45 1.90.2.4 @@ -1,11 +1,11 @@ /** @file Parser: @b image parser class. - Copyright(c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright(c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_IMAGE_C="$Date: 2002/11/28 12:23:39 $"; +static const char* IDENT_IMAGE_C="$Date: 2003/02/04 14:04:45 $"; /* jpegsize: gets the width and height (in pixels) of a jpeg file @@ -24,12 +24,13 @@ static const char* IDENT_IMAGE_C="$Date: #include "pa_request.h" #include "pa_vfile.h" #include "pa_vimage.h" +#include "pa_vdate.h" // class class MImage : public Methoded { public: // VStateless_class - Value *create_new_value(Pool& pool) { return new(pool) VImage(pool); } + ValuePtr create_new_value() { return ValuePtr(new VImage()); } public: MImage(Pool& pool); @@ -41,6 +42,10 @@ public: // Methoded // helpers +/// value of exif tag -> it's value +Hash exif_tag_value2name; + + #ifndef DOXYGEN class Measure_reader { public: @@ -51,7 +56,7 @@ public: class Measure_file_reader: public Measure_reader { public: - Measure_file_reader(Pool& apool, int af, const String& afile_name, const char *afname): + Measure_file_reader(Pool& apool, int af, const String& afile_name, const char* afname): pool(apool), file_name(afile_name), fname(afname), f(af) { } @@ -72,7 +77,7 @@ public: /*override*/void seek(long value, int whence) { if(lseek(f, value, whence)<0) - throw Exception("file.seek", + throw Exception("image.format", &file_name, "seek(value=%ld, whence=%d) failed: %s (%d), actual filename '%s'", value, whence, strerror(errno), errno, fname); @@ -82,7 +87,7 @@ public: private: Pool& pool; - const String& file_name; const char *fname; + const String& file_name; const char* fname; int f; }; @@ -104,11 +109,11 @@ public: switch(whence) { case SEEK_CUR: new_offset=offset+value; break; case SEEK_SET: new_offset=(size_t)value; break; - default: throw Exception("file.seek", 0, "whence #%d not supported", 0, whence); break; + default: throw Exception(0, 0, "whence #%d not supported", 0, whence); break; // never } if((ssize_t)new_offset<0 || new_offset>size) - throw Exception("file.seek", + throw Exception("image.format", &file_name, "seek(value=%l, whence=%d) failed: out of buffer, new_offset>size (%l>%l) or new_offset<0", value, whence, new_offset, size); @@ -189,6 +194,8 @@ struct JPG_Exif_IFD_entry { #define JPG_IFD_TAG_EXIF_OFFSET 0x8769 +#define JPEG_EXIF_DATE_CHARS 20 + // inline ushort x_endian_to_ushort(uchar b0, uchar b1) { @@ -275,14 +282,29 @@ static Value *parse_IFD_entry_formatted_ return 0; } +// date.C +time_t cstr_to_time_t(char *cstr, const String *report_error_origin); + static Value *parse_IFD_entry_formatted_value(Pool& pool, bool is_big, ushort format, size_t component_size, uint components_count, const uchar *value) { if(format==2) { // ascii string, exception: the only type with varying size - const char *cstr=(const char *)value; + const char* cstr=(const char* )value; size_t size=components_count; - if(const char *premature_zero_pos=(const char *)memchr(cstr, 0, size)) + // Data format is "YYYY:MM:DD HH:MM:SS"+0x00, total 20bytes + if(size==JPEG_EXIF_DATE_CHARS + && isdigit(cstr[0]) + && cstr[JPEG_EXIF_DATE_CHARS-1]==0) { + char cstr_writable[JPEG_EXIF_DATE_CHARS]; + strcpy(cstr_writable, cstr); + + time_t t=cstr_to_time_t(cstr_writable, 0/* do not throw exception, just return bad result */); + if(t>=0) + return new(pool) VDate(pool, t); + } + + if(const char* premature_zero_pos=(const char* )memchr(cstr, 0, size)) size=premature_zero_pos-cstr; return new(pool) VString(*new(pool) String(pool, cstr, size, true/*tainted*/)); } @@ -390,7 +412,7 @@ static void parse_IFD_entry(Pool& pool, skey << buf; } - if(const char *name=(const char *)exif_tag_value2name->get(skey)) + if(const char* name=(const char* )exif_tag_value2name->get(skey)) hash.put(*new(pool) String(pool, name), value); else hash.put(skey, value); @@ -538,7 +560,7 @@ static void measure_png(Pool& pool, cons static void measure(Pool& pool, const String& file_name, Measure_reader& reader, ushort& width, ushort& height, Value ** exif) { - if(const char *cext=strrchr(file_name.cstr(String::UL_FILE_SPEC), '.')) { + if(const char* cext=strrchr(file_name.cstr(String::UL_FILE_SPEC), '.')) { cext++; if(strcasecmp(cext, "GIF")==0) measure_gif(pool, &file_name, reader, width, height); @@ -568,7 +590,7 @@ struct File_measure_action_info { #endif static void file_measure_action(Pool& pool, struct stat& finfo, int f, - const String& file_spec, const char *fname, bool as_text, + const String& file_spec, const char* fname, bool as_text, void *context) { File_measure_action_info& info=*static_cast(context); @@ -576,10 +598,10 @@ static void file_measure_action(Pool& po measure(pool, *info.file_name, reader, *info.width, *info.height, info.exif); } -static void _measure(Request& r, const String& method_name, MethodParams *params) { +static void _measure(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); - Value& data=params->as_no_junction(0, "data must not be code"); + Value& data=params.as_no_junction(0, "data must not be code"); ushort width=0; ushort height=0; @@ -623,7 +645,7 @@ static void append_attrib_pair(const Has if(value.is_string() || value.as_int()>=0) *ai.tag << "=\"" << value.as_string() << "\""; } -static void _html(Request& r, const String& method_name, MethodParams *params) { +static void _html(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); String tag(pool); @@ -632,9 +654,9 @@ static void _html(Request& r, const Stri const Hash& fields=static_cast(r.get_self())->fields(); Hash *attribs=0; - if(params->size()) { + if(params.count()) { // for backward compatibility: someday was ^html{} - Value &vattribs=r.process_to_value(params->get(0), + Value &vattribs=r.process_to_value(params.get(0), /*0/*no name* /,*/ false/*don't intercept string*/); if(!vattribs.is_string()) // allow empty @@ -658,7 +680,7 @@ static gdImage *load(Request& r, const S const String& file_name){ Pool& pool=r.pool(); - const char *file_name_cstr=r.absolute(file_name).cstr(String::UL_FILE_SPEC); + const char* file_name_cstr=r.absolute(file_name).cstr(String::UL_FILE_SPEC); if(FILE *f=fopen(file_name_cstr, "rb")) { gdImage& image=*new(pool) gdImage(pool); bool ok=image.CreateFromGif(f); @@ -677,10 +699,10 @@ static gdImage *load(Request& r, const S } -static void _load(Request& r, const String& method_name, MethodParams *params) { +static void _load(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); - const String& file_name=params->as_string(0, "file name must not be code"); + const String& file_name=params.as_string(0, "file name must not be code"); gdImage& image=*load(r, method_name, file_name); int width=image.SX(); @@ -688,21 +710,21 @@ static void _load(Request& r, const Stri static_cast(r.get_self())->set(&file_name, width, height, &image); } -static void _create(Request& r, const String& method_name, MethodParams *params) { +static void _create(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); - int width=params->as_int(0, "width must be int", r); - int height=params->as_int(1, "height must be int", r); + int width=params.as_int(0, "width must be int", r); + int height=params.as_int(1, "height must be int", r); int bgcolor_value=0xffFFff; - if(params->size()>2) - bgcolor_value=params->as_int(2, "color must be int", r); + if(params.count()>2) + bgcolor_value=params.as_int(2, "color must be int", r); gdImage& image=*new(pool) gdImage(pool); image.Create(width, height); image.FilledRectangle(0, 0, width-1, height-1, image.Color(bgcolor_value)); static_cast(r.get_self())->set(0, width, height, &image); } -static void _gif(Request& r, const String& method_name, MethodParams *params) { +static void _gif(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -723,7 +745,7 @@ static void _gif(Request& r, const Strin r.write_no_lang(vfile); } -static void _line(Request& r, const String& method_name, MethodParams *params) { +static void _line(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -733,14 +755,14 @@ static void _line(Request& r, const Stri "does not contain an image"); image->Line( - params->as_int(0, "x0 must be int", r), - params->as_int(1, "y0 must be int", r), - params->as_int(2, "x1 must be int", r), - params->as_int(3, "y1 must be int", r), - image->Color(params->as_int(4, "color must be int", r))); + params.as_int(0, "x0 must be int", r), + params.as_int(1, "y0 must be int", r), + params.as_int(2, "x1 must be int", r), + params.as_int(3, "y1 must be int", r), + image->Color(params.as_int(4, "color must be int", r))); } -static void _fill(Request& r, const String& method_name, MethodParams *params) { +static void _fill(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -750,12 +772,12 @@ static void _fill(Request& r, const Stri "does not contain an image"); image->Fill( - params->as_int(0, "x must be int", r), - params->as_int(1, "y must be int", r), - image->Color(params->as_int(2, "color must be int", r))); + params.as_int(0, "x must be int", r), + params.as_int(1, "y must be int", r), + image->Color(params.as_int(2, "color must be int", r))); } -static void _rectangle(Request& r, const String& method_name, MethodParams *params) { +static void _rectangle(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -765,14 +787,14 @@ static void _rectangle(Request& r, const "does not contain an image"); image->Rectangle( - params->as_int(0, "x0 must be int", r), - params->as_int(1, "y0 must be int", r), - params->as_int(2, "x1 must be int", r), - params->as_int(3, "y1 must be int", r), - image->Color(params->as_int(4, "color must be int", r))); + params.as_int(0, "x0 must be int", r), + params.as_int(1, "y0 must be int", r), + params.as_int(2, "x1 must be int", r), + params.as_int(3, "y1 must be int", r), + image->Color(params.as_int(4, "color must be int", r))); } -static void _bar(Request& r, const String& method_name, MethodParams *params) { +static void _bar(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -782,11 +804,11 @@ static void _bar(Request& r, const Strin "does not contain an image"); image->FilledRectangle( - params->as_int(0, "x0 must be int", r), - params->as_int(1, "y0 must be int", r), - params->as_int(2, "x1 must be int", r), - params->as_int(3, "y1 must be int", r), - image->Color(params->as_int(4, "color must be int", r))); + params.as_int(0, "x0 must be int", r), + params.as_int(1, "y0 must be int", r), + params.as_int(2, "x1 must be int", r), + params.as_int(3, "y1 must be int", r), + image->Color(params.as_int(4, "color must be int", r))); } #ifndef DOXYGEN @@ -799,7 +821,7 @@ static void add_point(Array::Item *value (*p)++; } #endif -static void _replace(Request& r, const String& method_name, MethodParams *params) { +static void _replace(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -808,7 +830,7 @@ static void _replace(Request& r, const S &method_name, "does not contain an image"); - Table *table=params->as_no_junction(2, "coordinates must not be code").get_table(); + Table *table=params.as_no_junction(2, "coordinates must not be code").get_table(); if(!table) throw Exception(0, &method_name, @@ -818,11 +840,11 @@ static void _replace(Request& r, const S gdImage::Point *add_p=all_p; table->for_each(add_point, &add_p); image->FilledPolygonReplaceColor(all_p, table->size(), - image->Color(params->as_int(0, "src color must be int", r)), - image->Color(params->as_int(1, "dest color must be int", r))); + image->Color(params.as_int(0, "src color must be int", r)), + image->Color(params.as_int(1, "dest color must be int", r))); } -static void _polyline(Request& r, const String& method_name, MethodParams *params) { +static void _polyline(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -831,7 +853,7 @@ static void _polyline(Request& r, const &method_name, "does not contain an image"); - Table *table=params->as_no_junction(1, "coordinates must not be code").get_table(); + Table *table=params.as_no_junction(1, "coordinates must not be code").get_table(); if(!table) throw Exception(0, &method_name, @@ -841,11 +863,11 @@ static void _polyline(Request& r, const gdImage::Point *add_p=all_p; table->for_each(add_point, &add_p); image->Polygon(all_p, table->size(), - image->Color(params->as_int(0, "color must be int", r)), + image->Color(params.as_int(0, "color must be int", r)), false/*not closed*/); } -static void _polygon(Request& r, const String& method_name, MethodParams *params) { +static void _polygon(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -854,7 +876,7 @@ static void _polygon(Request& r, const S &method_name, "does not contain an image"); - Table *table=params->as_no_junction(1, "coordinates must not be code").get_table(); + Table *table=params.as_no_junction(1, "coordinates must not be code").get_table(); if(!table) throw Exception(0, &method_name, @@ -864,10 +886,10 @@ static void _polygon(Request& r, const S gdImage::Point *add_p=all_p; table->for_each(add_point, &add_p); image->Polygon(all_p, table->size(), - image->Color(params->as_int(0, "color must be int", r))); + image->Color(params.as_int(0, "color must be int", r))); } -static void _polybar(Request& r, const String& method_name, MethodParams *params) { +static void _polybar(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -876,7 +898,7 @@ static void _polybar(Request& r, const S &method_name, "does not contain an image"); - Table *table=params->as_no_junction(1, "coordinates must not be code").get_table(); + Table *table=params.as_no_junction(1, "coordinates must not be code").get_table(); if(!table) throw Exception("parser.runtime", &method_name, @@ -886,7 +908,7 @@ static void _polybar(Request& r, const S gdImage::Point *add_p=all_p; table->for_each(add_point, &add_p); image->FilledPolygon(all_p, table->size(), - image->Color(params->as_int(0, "color must be int", r))); + image->Color(params.as_int(0, "color must be int", r))); } // font @@ -944,7 +966,7 @@ public: // counts trailing letter_spacing, consider this OK. useful for contiuations int string_width(const String& s){ - const char *cstr=s.cstr(); + const char* cstr=s.cstr(); int result=0; for(; *cstr; cstr++) result+=step_width(index_of(*cstr)); @@ -952,7 +974,7 @@ public: } void string_display(gdImage& image, int x, int y, const String& s){ - const char *cstr=s.cstr(); + const char* cstr=s.cstr(); if(cstr) for(; *cstr; cstr++) { int index=index_of(*cstr); index_display(image, x, y, index); @@ -963,15 +985,15 @@ public: }; const int Font::letter_spacing=1; -static void _font(Request& r, const String& method_name, MethodParams *params) { +static void _font(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); - const String& alphabet=params->as_string(0, "alphabet must not be code"); - gdImage& image=*load(r, method_name, params->as_string(1, "file_name must not be code")); - int spacebar_width=params->as_int(2, "spacebar_width must be int", r); + const String& alphabet=params.as_string(0, "alphabet must not be code"); + gdImage& image=*load(r, method_name, params.as_string(1, "file_name must not be code")); + int spacebar_width=params.as_int(2, "spacebar_width must be int", r); int monospace_width; - if(params->size()>3) { - monospace_width=params->as_int(3, "monospace_width must be int", r); + if(params.count()>3) { + monospace_width=params.as_int(3, "monospace_width must be int", r); if(!monospace_width) monospace_width=image.SX(); } else @@ -994,12 +1016,12 @@ static void _font(Request& r, const Stri image.SY() / alphabet.size(), monospace_width, spacebar_width); } -static void _text(Request& r, const String& method_name, MethodParams *params) { +static void _text(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); - int x=params->as_int(0, "x must be int", r); - int y=params->as_int(1, "y must be int", r); - const String& s=params->as_string(2, "text must not be code"); + int x=params.as_int(0, "x must be int", r); + int y=params.as_int(1, "y must be int", r); + const String& s=params.as_string(2, "text must not be code"); VImage& vimage=*static_cast(r.get_self()); if(vimage.image) @@ -1015,10 +1037,10 @@ static void _text(Request& r, const Stri "does not contain an image"); } -static void _length(Request& r, const String& method_name, MethodParams *params) { +static void _length(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); - const String& s=params->as_string(0, "text must not be code"); + const String& s=params.as_string(0, "text must not be code"); VImage& vimage=*static_cast(r.get_self()); if(vimage.image) @@ -1034,7 +1056,7 @@ static void _length(Request& r, const St "does not contain an image"); } -static void _arc(Request& r, const String& method_name, MethodParams *params) { +static void _arc(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -1044,16 +1066,16 @@ static void _arc(Request& r, const Strin "does not contain an image"); image->Arc( - params->as_int(0, "center_x must be int", r), - params->as_int(1, "center_y must be int", r), - params->as_int(2, "width must be int", r), - params->as_int(3, "height must be int", r), - params->as_int(4, "start degrees must be int", r), - params->as_int(5, "end degrees must be int", r), - image->Color(params->as_int(6, "cx must be int", r))); + params.as_int(0, "center_x must be int", r), + params.as_int(1, "center_y must be int", r), + params.as_int(2, "width must be int", r), + params.as_int(3, "height must be int", r), + params.as_int(4, "start degrees must be int", r), + params.as_int(5, "end degrees must be int", r), + image->Color(params.as_int(6, "cx must be int", r))); } -static void _sector(Request& r, const String& method_name, MethodParams *params) { +static void _sector(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -1063,16 +1085,16 @@ static void _sector(Request& r, const St "does not contain an image"); image->Sector( - params->as_int(0, "center_x must be int", r), - params->as_int(1, "center_y must be int", r), - params->as_int(2, "width must be int", r), - params->as_int(3, "height must be int", r), - params->as_int(4, "start degrees must be int", r), - params->as_int(5, "end degrees must be int", r), - image->Color(params->as_int(6, "color must be int", r))); + params.as_int(0, "center_x must be int", r), + params.as_int(1, "center_y must be int", r), + params.as_int(2, "width must be int", r), + params.as_int(3, "height must be int", r), + params.as_int(4, "start degrees must be int", r), + params.as_int(5, "end degrees must be int", r), + image->Color(params.as_int(6, "color must be int", r))); } -static void _circle(Request& r, const String& method_name, MethodParams *params) { +static void _circle(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *image=static_cast(r.get_self())->image; @@ -1081,22 +1103,22 @@ static void _circle(Request& r, const St &method_name, "does not contain an image"); - int size=params->as_int(2, "radius must be int", r)*2; + int size=params.as_int(2, "radius must be int", r)*2; image->Arc( - params->as_int(0, "center_x must be int", r), - params->as_int(1, "center_y must be int", r), + params.as_int(0, "center_x must be int", r), + params.as_int(1, "center_y must be int", r), size, //w size, //h 0, //s 360, //e - image->Color(params->as_int(3, "color must be int", r))); + image->Color(params.as_int(3, "color must be int", r))); } -gdImage& as_image(Pool& pool, const String& method_name, MethodParams *params, - int index, const char *msg) { +gdImage& as_image(Pool& pool, StringPtr method_name, MethodParams& params, + int index, const char* msg) { gdImage *src=0; - Value& value=params->as_no_junction(index, msg); + Value& value=params.as_no_junction(index, msg); if(Value *vimage=value.as(VIMAGE_TYPE, false)) { src=static_cast(vimage)->image; @@ -1112,7 +1134,7 @@ gdImage& as_image(Pool& pool, const Stri return *src; } -static void _copy(Request& r, const String& method_name, MethodParams *params) { +static void _copy(Request& r, StringPtr method_name, MethodParams& params) { Pool& pool=r.pool(); gdImage *dest=static_cast(r.get_self())->image; @@ -1123,18 +1145,18 @@ static void _copy(Request& r, const Stri gdImage& src=as_image(pool, method_name, params, 0, "src must be image"); - int sx=params->as_int(1, "src_x must be int", r); - int sy=params->as_int(2, "src_y must be int", r); - int sw=params->as_int(3, "src_w must be int", r); - int sh=params->as_int(4, "src_h must be int", r); - int dx=params->as_int(5, "dest_x must be int", r); - int dy=params->as_int(6, "dest_y must be int", r); - if(params->size()>1+2+2+2) { - int dw=params->as_int(1+2+2+2, "dest_w must be int", r); - int dh=(int)(params->size()>1+2+2+2+1? - params->as_int(1+2+2+2+1, "dest_h must be int", r):sh*(((double)dw)/((double)sw))); - int tolerance=params->size()>1+2+2+2+2? - params->as_int(1+2+2+2+2, "tolerance must be int", r):150; + int sx=params.as_int(1, "src_x must be int", r); + int sy=params.as_int(2, "src_y must be int", r); + int sw=params.as_int(3, "src_w must be int", r); + int sh=params.as_int(4, "src_h must be int", r); + int dx=params.as_int(5, "dest_x must be int", r); + int dy=params.as_int(6, "dest_y must be int", r); + if(params.count()>1+2+2+2) { + int dw=params.as_int(1+2+2+2, "dest_w must be int", r); + int dh=(int)(params.count()>1+2+2+2+1? + params.as_int(1+2+2+2+1, "dest_h must be int", r):sh*(((double)dw)/((double)sw))); + int tolerance=params.count()>1+2+2+2+2? + params.as_int(1+2+2+2+2, "tolerance must be int", r):150; src.CopyResampled(*dest, dx, dy, sx, sy, dw, dh, sw, sh, tolerance); } else @@ -1216,5 +1238,101 @@ Methoded *image_class; // creator Methoded *MImage_create(Pool& pool) { + // image JPEG Exif + #define EXIF_TAG(tag, name) \ + exif_tag_value2name.put(tag, #name); + // Tags used by IFD0 (main image) + EXIF_TAG(0x010e, ImageDescription); + EXIF_TAG(0x010f, Make); + EXIF_TAG(0x0110, Model); + EXIF_TAG(0x0112, Orientation); + EXIF_TAG(0x011a, XResolution); + EXIF_TAG(0x011b, YResolution); + EXIF_TAG(0x0128, ResolutionUnit); + EXIF_TAG(0x0131, Software); + EXIF_TAG(0x0132, DateTime); + EXIF_TAG(0x013e, WhitePoint); + EXIF_TAG(0x013f, PrimaryChromaticities); + EXIF_TAG(0x0211, YCbCrCoefficients); + EXIF_TAG(0x0213, YCbCrPositioning); + EXIF_TAG(0x0214, ReferenceBlackWhite); + EXIF_TAG(0x8298, Copyright); + EXIF_TAG(0x8769, ExifOffset); + // Tags used by Exif SubIFD + EXIF_TAG(0x829a, ExposureTime); + EXIF_TAG(0x829d, FNumber); + EXIF_TAG(0x8822, ExposureProgram); + EXIF_TAG(0x8827, ISOSpeedRatings); + EXIF_TAG(0x9000, ExifVersion); + EXIF_TAG(0x9003, DateTimeOriginal); + EXIF_TAG(0x9004, DateTimeDigitized); + EXIF_TAG(0x9101, ComponentsConfiguration); + EXIF_TAG(0x9102, CompressedBitsPerPixel); + EXIF_TAG(0x9201, ShutterSpeedValue); + EXIF_TAG(0x9202, ApertureValue); + EXIF_TAG(0x9203, BrightnessValue); + EXIF_TAG(0x9204, ExposureBiasValue); + EXIF_TAG(0x9205, MaxApertureValue); + EXIF_TAG(0x9206, SubjectDistance); + EXIF_TAG(0x9207, MeteringMode); + EXIF_TAG(0x9208, LightSource); + EXIF_TAG(0x9209, Flash); + EXIF_TAG(0x920a, FocalLength); + EXIF_TAG(0x927c, MakerNote); + EXIF_TAG(0x9286, UserComment); + EXIF_TAG(0x9290, SubsecTime); + EXIF_TAG(0x9291, SubsecTimeOriginal); + EXIF_TAG(0x9292, SubsecTimeDigitized); + EXIF_TAG(0xa000, FlashPixVersion); + EXIF_TAG(0xa001, ColorSpace); + EXIF_TAG(0xa002, ExifImageWidth); + EXIF_TAG(0xa003, ExifImageHeight); + EXIF_TAG(0xa004, RelatedSoundFile); + EXIF_TAG(0xa005, ExifInteroperabilityOffset); + EXIF_TAG(0xa20e, FocalPlaneXResolution); + EXIF_TAG(0xa20f, FocalPlaneYResolution); + EXIF_TAG(0xa210, FocalPlaneResolutionUnit); + EXIF_TAG(0xa215, ExposureIndex); + EXIF_TAG(0xa217, SensingMethod); + EXIF_TAG(0xa300, FileSource); + EXIF_TAG(0xa301, SceneType); + EXIF_TAG(0xa302, CFAPattern); + // Misc Tags + EXIF_TAG(0x00fe, NewSubfileType); + EXIF_TAG(0x00ff, SubfileType); + EXIF_TAG(0x012d, TransferFunction); + EXIF_TAG(0x013b, Artist); + EXIF_TAG(0x013d, Predictor); + EXIF_TAG(0x0142, TileWidth); + EXIF_TAG(0x0143, TileLength); + EXIF_TAG(0x0144, TileOffsets); + EXIF_TAG(0x0145, TileByteCounts); + EXIF_TAG(0x014a, SubIFDs); + EXIF_TAG(0x015b, JPEGTables); + EXIF_TAG(0x828d, CFARepeatPatternDim); + EXIF_TAG(0x828e, CFAPattern); + EXIF_TAG(0x828f, BatteryLevel); + EXIF_TAG(0x83bb, IPTC/NAA); + EXIF_TAG(0x8773, InterColorProfile); + EXIF_TAG(0x8824, SpectralSensitivity); + EXIF_TAG(0x8825, GPSInfo); + EXIF_TAG(0x8828, OECF); + EXIF_TAG(0x8829, Interlace); + EXIF_TAG(0x882a, TimeZoneOffset); + EXIF_TAG(0x882b, SelfTimerMode); + EXIF_TAG(0x920b, FlashEnergy); + EXIF_TAG(0x920c, SpatialFrequencyResponse); + EXIF_TAG(0x920d, Noise); + EXIF_TAG(0x9211, ImageNumber); + EXIF_TAG(0x9212, SecurityClassification); + EXIF_TAG(0x9213, ImageHistory); + EXIF_TAG(0x9214, SubjectLocation); + EXIF_TAG(0x9215, ExposureIndex); + EXIF_TAG(0x9216, TIFF/EPStandardID); + EXIF_TAG(0xa20b, FlashEnergy); + EXIF_TAG(0xa20c, SpatialFrequencyResponse); + EXIF_TAG(0xa214, SubjectLocation); + #undef EXIF_TAG + return image_class=new(pool) MImage(pool); }