Index: libgthumb/gth-exif-utils.c
===================================================================
--- libgthumb/gth-exif-utils.c	(revision 1582)
+++ libgthumb/gth-exif-utils.c	(working copy)
@@ -668,15 +668,16 @@
  
 #define IFD_NAME_PUSH(val) names[ni++] = val;
 #define IFD_NAME_PULL()    names[--ni]
- 
-int
-gth_minimal_exif_tag_write (const char *filename,
- 	                    ExifTag     etag,
- 			    void       *data,
- 			    int         size,
- 			    int         ifds)
+
+int static
+gth_minimal_exif_tag_action (const char *filename,
+			     ExifTag     etag,
+			     void       *data,
+			     int         size,
+			     int         ifds,
+			     int         access)
 {
-	/* This function updates ONLY the affected tag. Unlike libexif, it does
+	/* This function updates/reads ONLY the affected tag. Unlike libexif, it does
 	   not attempt to correct or re-format other data. This helps preserve
 	   the integrity of certain MakerNote entries, by avoiding re-positioning
 	   of the data whenever possible. Some MakerNotes incorporate absolute
@@ -818,25 +819,49 @@
  				// Copy the data
  				stitch = 0;			       
  				while (stitch < count){
- 					switch (types[type]){
- 					case 1:
- 						buf[tiff + offset + stitch] = *(char *) (data + stitch);
- 						break;
- 					case 2:
- 						*((unsigned short*)(&buf[tiff + offset + stitch * 2])) = 
- 							ENDIAN16_IT(*(guint16 *) (data + stitch * 2));
- 						break;
- 					case 4:
- 						*((unsigned long*) (&buf[tiff + offset + stitch * 4])) = 
- 							ENDIAN32_IT(*(guint32 *) (data + stitch * 4));
- 						break;
- 					default:
- 						fprintf(stderr, "gth_minimal_exif_tag_write:unsupported element size\n");
-						return PATCH_EXIF_UNSUPPORTED_TYPE;
- 					}
- 					stitch++;
- 				}
- 			}
+					if (access == 1){
+						switch (types[type]){
+						case 1:
+							buf[tiff + offset + stitch] = *(char *) (data + stitch);
+							break;
+						case 2:
+							*((unsigned short*)(&buf[tiff + offset + stitch * 2])) = 
+								ENDIAN16_IT(*(guint16 *) (data + stitch * 2));
+							break;
+						case 4:
+							*((unsigned long*) (&buf[tiff + offset + stitch * 4])) = 
+								ENDIAN32_IT(*(guint32 *) (data + stitch * 4));
+							break;
+						default:
+							fprintf(stderr, "gth_minimal_exif_tag_write:unsupported element size\n");
+							return PATCH_EXIF_UNSUPPORTED_TYPE;
+						}
+						stitch++;
+					}
+					else{
+						switch (types[type]){
+						case 1:
+							*(char *) (data + stitch) = buf[tiff + offset + stitch];
+							break;
+						case 2:
+							*(guint16 *) (data + stitch * 2) = 
+								DE_ENDIAN16(*((unsigned short*)(&buf[tiff + offset + stitch * 2])));
+							
+							break;
+						case 4:
+							*(guint32 *) (data + stitch * 4) =
+								DE_ENDIAN32(*((unsigned long*) (&buf[tiff + offset + stitch * 4])));
+							
+							break;
+						default:
+							fprintf(stderr, "gth_minimal_exif_tag_read:unsupported element size\n");
+							return PATCH_EXIF_UNSUPPORTED_TYPE;
+						}
+						stitch++;
+					}					
+				}
+				if (access == 0) return PATCH_EXIF_OK;
+			}
  			// EXIF pointer tag?
  			else if (bcmp(&buf[i], (char *)&exififd, 2) == 0){ 
  				IFD_OFFSET_PUSH(offset + tiff);
@@ -877,6 +902,28 @@
 }
 
 
+int
+gth_minimal_exif_tag_read (const char *filename,
+ 	                    ExifTag     etag,
+ 			    void       *data,
+ 			    int         size,
+ 			    int         ifds)
+{
+ 	debug (DEBUG_INFO, "gth_minimal_exif_tag_read(%s, %04x, %08x, %d, %02x)\n", filename, etag, data, size, ifds); 
+	return gth_minimal_exif_tag_action(filename, etag, data, size, ifds, 0);
+}
+
+int
+gth_minimal_exif_tag_write (const char *filename,
+ 	                    ExifTag     etag,
+ 			    void       *data,
+ 			    int         size,
+ 			    int         ifds)
+{
+ 	debug (DEBUG_INFO, "gth_minimal_exif_tag_write(%s, %04x, %08x, %d, %02x)\n", filename, etag, data, size, ifds); 
+	return gth_minimal_exif_tag_action(filename, etag, data, size, ifds, 1);
+}
+
 GthTransform
 read_orientation_field (const char *path)
 {
Index: libgthumb/gth-exif-utils.h
===================================================================
--- libgthumb/gth-exif-utils.h	(revision 1582)
+++ libgthumb/gth-exif-utils.h	(working copy)
@@ -66,6 +66,11 @@
                                            void         *data,
                                            int           size,
                                            int           ifds);
+int           gth_minimal_exif_tag_read  (const char   *filename,
+                                           ExifTag       etag,
+                                           void         *data,
+                                           int           size,
+                                           int           ifds);
 GthTransform  read_orientation_field      (const char   *path);
 void	      write_orientation_field     (const char   *filename, 
 				  	   GthTransform  transform);
