Good afternoon! I have some questions connected to structure JPEG. I ask to help to understand.
1. What for in JPEG are necessary markers APP# (http://www.exiftool.org/TagNames/JPEG.html), and whether it is possible to delete them
2. Studied function "File Info" in Photoshop and I had a question. In section "File Info" there are "raw data", what it for the data?
3. Whether I have a JPEG-picture in color model CMYK it is possible to save it in RGB but so that a picture it is pixel-by-pixel hasn't changed.
4. Whether it is possible through ExifTool to edit meta data in JPEG?
Thanks for attention!
Quote from: lorents on October 12, 2010, 04:07:15 AM
1. What for in JPEG are necessary markers APP# (http://www.exiftool.org/TagNames/JPEG.html), and whether it is possible to delete them
You can delete them all with
exiftool -all=. Or individual APP segments are deleted by deleting the metadata they contain. (ie.
-exif:all= deletes the EXIF APP1 segment)
Quote
2. Studied function "File Info" in Photoshop and I had a question. In section "File Info" there are "raw data", what it for the data?
I have no idea what you are talking about.
Quote
3. Whether I have a JPEG-picture in color model CMYK it is possible to save it in RGB but so that a picture it is pixel-by-pixel hasn't changed.
I don't know if this is possible. ExifTool won't do this though.
Quote
4. Whether it is possible through ExifTool to edit meta data in JPEG?
Yes.
- Phil
Thanks that have answered.
Generally ExifTool allows to convert images from CMYK in RGB?
Forgive, I not much not in a subject, ExifTool support editing Chunk in PNG.
And still where it is possible to find on a site help to us account ExifTool connected with PNG and JPEG, I unfortunately couldn't find, I have found only
http://www.exiftool.org/TagNames/index.html
And what for markers APP # are necessary?
Phil Harvey, ExifTool the excellent program, I hope it and will develop further
ExifTool does not edit image data, so it can not be used to convert from CMYK to RGB.
None of the APP markers are necessary.
It seems you may also be referring to the APP profile chunks in PNG images. These are completely undocumented as far as I know, but may be written by ImageMagic when converting from JPEG to PNG, so ExifTool supports reading/writing these chunks.
- Phil
I not absolutely have understood you, APP it is possible to delete safely?
Don't prompt, where on a site help ExifTool?
The APP segments only contain metadata, so deleting them is fairly safe. The only metadata that affects the way the image is drawn is orientation information and color profile information. If you can live without these then it is safe to delete the APP segments.
There is no general help with metadata like this on the ExifTool site.
- Phil
Whether it is possible through ExifTool to edit Chunk in PNG also, as through program TweakPNG (http://entropymine.com/jason/tweakpng/)
Quote from: Phil Harvey on October 12, 2010, 11:48:04 AM
The only metadata that affects the way the image is drawn is orientation information and color profile information.
What it is meta data?
Phil Harvey, you me have very strongly helped, many thanks
Quote from: lorents on October 12, 2010, 11:52:18 AM
What it is meta data?
See the Wikipedia metadata article (http://en.wikipedia.org/wiki/Metadata) for a good description.
- Phil
I meant, not that such the metadata.
And what are better be not to deleting?
Forgive for my bad English
Quote from: lorents on October 12, 2010, 12:18:38 PM
And what are better be not to deleting?
It depends on what is important to you. All metadata is important to me, so I don't delete any of it. I like to be able to tell my camera settings when looking at my images. But many people delete all metadata from an image if they are worried about privacy and/or file size, especially when sharing images on the internet.
- Phil
Thanks, have very strongly helped today.
Whether it is possible through ExifTool to edit Chunk in PNG also, as through program TweakPNG (http://entropymine.com/jason/tweakpng/)
Yes, ExifTool will edit metadata chunks in PNG images.
- Phil
Phil Harvey, thanks that all my questions have answered.
And thanks for your program, now I her admirer
Once again forgive, for my bad English
Good evening!
Prompt, please, as from ExifTool it will be possible to make the separate program which to work only with JPEG?
It would be possible to to do this, but some modification of ExifTool.pm would be required to disable the other file types.
- Phil
It is possible more in detail as it to make?
You could start by just removing all other entries from the %fileTypeLookup hash and deleting the corresponding modules from lib/Image/ExifTool (see the %moduleName lookup to get the module names for each file type).
Then you would have to run lots and lots of tests to see if the JPEG parsing relied on anything you removed.
- Phil
Clearly, thanks I will try.
Good afternoon!
Prompt please how it is possible to remove only certain markers?
The syntax is
exiftool -TAG= ...
See the FAQ number 2 (https://exiftool.org/faq.html#Q2) for help determining the TAG names.
- Phil
And where it is possible to receive the list about all possible TAG names.
And still, how to make that exiftool didn't create a file * _original
Hi,
You can see list (and description) of tags here:
http://www.exiftool.org/TagNames/EXIF.html
http://www.exiftool.org/TagNames/IPTC.html
http://www.exiftool.org/TagNames/XMP.html
To get list of tags from ExifTool, you can use command(s):
exiftool -list -exif:all
exiftool -list -iptc:all
exiftool -list -xmp:all
To prevent creating *_original files, use:
exiftool -overwrite_original -exif:artist="My name" myPhoto.jpg
Bogdan
Thanks for an explanation.
It is possible to receive the complete list of those elements which leave at-all =?
Whether also it is possible an example of removal of a certain element from EXIF Tags?
BogdanH, you speak Russian?
Hi,
If command:
exiftool -all= *.*
-is executed on jpg files, then all metadata will be deletet in file. If the same command is executed on tiff based files (raw), then not all metadata will be deleted, because image data is part of metadata.
To delete particular tag in exif, you write:
exiftool -exif:Artist= myPhoto.jpg
or to delete a group of tags inside exif:
exiftool -exif:ExifIFD= myPhoto.jpg
or you can combine, for example:
exiftool -exif:Artist= -GPS:All= myPhoto.jpg
No, even my name is Slavic, I don't speak Russian -but I did visit Moscow in 2008 :)
Bogdan
When I use exiftool-all = for JPEG all metadata leaves.
And where it is possible to find the complete list of the metadata?
-GPS:all=
-EXIF:all=
-IPTC:all=
-XMP:all=
-JFIF:all=
-ICC_Profile:all=
That is correct:
exiftool -exif:All= myPhoto.jpg
That is wrong:
exiftool -exif:All = myPhoto.jpg
^-space!
All metadata related info can be found on ExifTool homepage:
http://www.exiftool.org/
-look at the top of the page: EXIF, GPS, IPTC, XMP,....
Bogdan
And there is no simply a list of the metadata which it is possible to delete from JPEG using exiftool?
And it is possible to make the version exiftool которя works only for removal of the metadata from the metadata from JPEG?
Also can eat the separated script for this purpose?
Hi,
I am afraid, we have a language problem here...
As said above, with ExifTool, you can delete any metadata tag from jpg file. If you wish to delete all exif tags in jpg files only, then you can use command like:
exiftool -exif:all= -ext jpg d:\test\photo
-this will delete complete exif metadata from jpg files in d:\test\photo.
Bogdan
Look, I want to receive the complete list tags which can be removed from JPEG using ExifTool
And there are other analogs ExifTool for removal of the metadata from JPEG, dirty jhead
Hi Lorents,
ExifTool can delete all metadata from a JPEG image. The complete list of all metadata tags recognized by ExifTool is given by the command:
exiftool -list
However, many of these are for formats other than JPEG. Also, there are tags not in this list that will also be removed with -all= (any unknown tags).
I think that jhead may also be able to remove all metadata from a JPEG image, but I don't know for sure.
- Phil
Prompt, how it is possible to remove all metadata from the image, and to leave only marker APP14?
Currently, ExifTool can't do this.
- Phil
There are other appendices, for removal of the metadata from JPEG?
I am only aware of exiftool and jhead, but I'm sure you will be able to find others.
- Phil
I have an image

If it to optimize using jhead -du the image looks so

Who doesn't know as it to avoid?
This is very interesting. I didn't know that deleting APP14 could affect the image. Maybe ExifTool shouldn't be deleting this when deleting all metadata. I will look into this.
- Phil
I just have noticed today it, I sit and I think what to do
Has noticed it and on images RGB and CMYK, on YCbCr all is normal.
Whether could write you on perl (or in any other language) script which could delete the certain metadata from JPEG?
Let's admit so
GPS
EXIF
IPTC
XMP
ICC_Profile
Comment
Other metadata
To make analog jhead, but with a wide choice of the metadata.
Good afternoon Phil Harvey!
Could find nothing in the Internet, on removal of the metadata. Whether there is a chance, what you write a separate script on removal of the metadata from JPEG?
For me it is very important that the script could work through cmd and supported RGB, CMYK and YCbCr.
I have updated ExifTool so that it doesn't delete the APP14 Adobe segment by default when deleting all metadata. This segment can be deleted if necessary with -adobe:all= or -adobe=, or extracted or copied as a block with the new "Adobe" tag.
ExifTool 8.79 has just been released with this new feature.
- Phil
Excellent work!
Wanted to learn into the account of my request, there is a chance, what you will make a separate script on perl on removal of the metadata?
Hi Lorents,
I have a script that you could modify to do this if you want. It removes various application segments from a JPEG image:
#!/usr/bin/perl -w
my $help = <<_END_;
#
# File: clean_jpg
#
# Description: Remove EXIF and PhotoShop junk from JPG files or directories
#
# Syntax: clean_jpg [OPTIONS] FILE/DIR [...]
#
# Options: -a - preserve all meta information except preview trailer
# -d - dummy mode (doesn't actually change the file)
# -e - preserve EXIF APP1 information
# -o - preserve other meta information (all but EXIF, XMP, PS)
# -p - preserve Photoshop APP13 information (includes IPTC)
# -r - recursively process sub-directories
# -i DIR - ignore specified directory
# -v - verbose
# -x - preserve XMP APP1 information
#
# Revisions: 10/20/03 - PH Created
# 12/22/03 - PH Allow multiple filenames to be specified
# 12/24/03 - PH Added dummy mode.
# Remove all 0xe0-f markers (not just 0xe1,2,d,e,f)
# 01/21/04 - PH Added -e option
# 11/30/04 - PH Clean up unpack calls
# 01/31/05 - PH Remove multiple 0xff's in segment headers
# 04/09/05 - PH Changed -e option to -a, and added -e, -o, -p and
# -x options
# 04/15/05 - PH Fixed problem where specified information wasn't
# being preserved if entire directory is cleaned
# 03/20/09 - PH Also remove COM segment
#
_END_
#
# Legal: Copyright (c) 2003-2009 Phil Harvey
# You are free to use/modify this script for non-profit
# purposes. Not responsible for loss or damages.
#
# Mail problems/comments to philharvey66 at gmail.com
#
use strict;
require 5.002;
sub CleanDir($;$);
sub CleanJpg($;$);
my @files;
my $recurse = 0;
my $verbose;
my $dummy;
my @ignore;
my $count = 0;
my $count_ok = 0;
my $count_dir = 0;
my $cleaned_bytes = 0;
my $preserve_flags = 0; # 1=exif, 2=xmp, 4=photoshop, 8=other
my $arg;
while ($arg = shift)
{
if ($arg =~ /^-/) {
for (my $i=1; ($_=substr $arg, $i, 1); ++$i) {
/a/ and $preserve_flags |= 0xff, next;
/d/ and $dummy = 1, next;
/e/ and $preserve_flags |= 0x01, next;
/i/ and push(@ignore,shift), next;
/o/ and $preserve_flags |= 0x08, next;
/p/ and $preserve_flags |= 0x04, next;
/r/ and $recurse = 1, next;
/v/ and $verbose = 1, next;
/x/ and $preserve_flags |= 0x02, next;
print "Unknown option $_\n";
exit 1;
}
} else {
push @files, $arg;
}
}
unless (@files) {
print $help;
exit 1;
}
my $filename;
foreach $filename (@files) {
if (-d $filename) {
CleanDir($filename, $preserve_flags);
} elsif (-e $filename) {
my $result = CleanJpg($filename, $preserve_flags);
if ($result > 1) {
++$count;
} elsif ($result > 0) {
++$count_ok;
}
} else {
die "Can't open $filename\n";
}
}
if ($count or $count_ok or $count_dir>1) {
printf("%5d directories scanned\n", $count_dir) if $count_dir > 1;
printf("%5d JPG files cleaned\n", $count) if $count;
printf("%5d JPG files already clean\n", $count_ok) if $count_ok;
if ($cleaned_bytes >= 102400000) {
printf("%5d MB saved\n", $cleaned_bytes / (1024*1024));
} elsif ($cleaned_bytes >= 100000) {
printf("%5d KB saved\n", $cleaned_bytes / 1024);
} else {
printf("%5d bytes saved\n", $cleaned_bytes);
}
print "But this was dummy mode, so nothing was changed\n" if $dummy;
} else {
print "Nothing to do.\n";
}
sub CleanDir($;$)
{
my $dir = shift;
my $keep_flags = shift || 0;
opendir(DIR_HANDLE, $dir) or die "Error opening directory $dir\n";
my @file_list = readdir(DIR_HANDLE);
closedir(DIR_HANDLE);
++$count_dir;
my $file;
foreach $file (@file_list) {
my $path = "$dir/$file";
if (-d $path) {
next if $file =~ /^\./; # ignore dirs starting with "."
next if grep /^$file$/, @ignore;
$recurse and CleanDir($path, $keep_flags);
next;
}
if ($file =~ /\.jpg$/i) {
my $result = CleanJpg($path, $keep_flags);
if ($result > 1) {
++$count;
} elsif ($result > 0) {
++$count_ok;
}
}
}
}
# rewrite a jpg file, removing EXIF data unless specified
# Inputs: 0) file name, 1) preserve flags (keep 1=exif, 2=xmp, 4=photoshop, 8=other)
# - returns 0 on error, 1 if nothing done, 2 if any junk was removed
# - also removes Canon preview image
sub CleanJpg($;$)
{
my $infile = shift;
my $keep_flags = shift || 0;
my $outfile = '';
my $success = 0;
my $found_junk = 0;
my ($s,$length,$buff);
my ($ch,$data,$ord_ch);
$verbose and print "File: $infile\n";
open(JPG_IN,$infile) or return $success;
binmode( JPG_IN );
# create name of temporary file in same directory
if ($infile =~ /(.*\/)/) {
$outfile = $1;
}
$outfile .= "icat_CleanJpg.tmp";
unless (open(JPG_OUT,">$outfile")) {
close(JPG_IN);
return $success;
}
binmode( JPG_OUT );
# set input record separator to 0xff (the JPEG marker) to make reading quicker
my $oldsep = $/;
$/ = "\xff";
if (read(JPG_IN,$s,2)==2 and $s eq "\xff\xd8" and print JPG_OUT $s) {
# read file until we reach an end of image (EOI)
Marker: for (;;) {
# Find next marker (JPEG markers begin with 0xff)
$data = <JPG_IN>;
defined($data) or last;
chomp $data; # remove 0xff
print JPG_OUT $data or last;
# JPEG markers can be padded with unlimited 0xff's
for (;;) {
read(JPG_IN, $ch, 1) or last Marker;
$ord_ch = ord($ch);
last if $ord_ch != 0xff; # exit loop before printing marker
++$cleaned_bytes;
}
my $hdr = "\xff" . $ch; # segment header
# Now, $ord_ch is the value of the marker.
if (($ord_ch >= 0xc0) && ($ord_ch <= 0xc3)) {
# this is an image block
read(JPG_IN, $buff, 7) == 7 or last;
print JPG_OUT $hdr,$buff or last;
# handle stand-alone markers 0x01 and 0xd0-0xd7
# (and the non-marker 0x00, which follows an 0xff if it exists in data)
} elsif ($ord_ch==0x00 or $ord_ch==0x01 or ($ord_ch>=0xd0 and $ord_ch<=0xd7)) {
print JPG_OUT $hdr or last;
} elsif ($ord_ch==0xd9) { # end of image (EOI)
print JPG_OUT $hdr and $success = 1;
my $curpos = tell(JPG_IN);
seek(JPG_IN, 0, 2); # seek to end of file
my $preview_size = tell(JPG_IN) - $curpos;
if ($preview_size) {
$verbose and printf(" Removed preview image (%d bytes)\n", $preview_size);
$found_junk = 1;
$cleaned_bytes += $preview_size;
}
last;
} else {
# We **MUST** skip variables, since FF's within variable names are
# NOT valid JPEG markers
read(JPG_IN, $s, 2) == 2 or last;
$length = unpack("n",$s);
last if $length < 2;
read(JPG_IN, $buff, $length-2) == $length-2 or last;
# print out this field unless we are ignoring it
my $remove;
if ($ord_ch >= 0xe0 and $ord_ch <= 0xef) {
if ($ord_ch==0xe1 and $buff=~/^Exif\0\0/) {
# EXIF APP1 segment
$remove = 1 unless $keep_flags & 0x01;
} elsif ($ord_ch==0xe1 and $buff=~/^http:\/\/ns.adobe.com\/xap\/1.0\/\0/) {
# XMP APP1 segment
$remove = 1 unless $keep_flags & 0x02;
} elsif ($ord_ch==0xed and $buff=~/^Photoshop 3.0\0/) {
# Photoshop APP13 segment
$remove = 1 unless $keep_flags & 0x04;
} else {
# Other application segment
$remove = 1 unless $keep_flags & 0x08;
}
} elsif ($ord_ch == 0xfe) {
# COM segment
$remove = 1 unless $keep_flags & 0x08;
}
if ($remove) {
$verbose and printf(" Marker 0x%x: %5d bytes -- Cleaned\n", $ord_ch, $length);
$found_junk = 1;
$cleaned_bytes += $length + 2;
} else {
$verbose and printf(" Marker 0x%x: %5d bytes -- Kept\n", $ord_ch, $length);
print JPG_OUT $hdr,$s,$buff or last;
}
}
}
}
$/ = $oldsep; # return separator to original value
close(JPG_IN);
close(JPG_OUT) or $success = 0;
if ($success and $found_junk and not $dummy) {
unless (rename($outfile,$infile)) {
$success = 0;
unlink($outfile);
}
} else {
unlink($outfile);
}
$success or $found_junk = 0;
return $success + $found_junk;
}
# end
- Phil
And you don't have script which could remove the following metadata:
xmp
exif
iptc
jfif
app14
comment
icc_profile
Other metadata
Both exiftool and the script I posted above will remove these.
- Phil
Look, to me скритп it is necessary for my project - Image Catalyst (http://forum.ru-board.com/topic.cgi?forum=4&topic=4263), and here now I search for a way to replace jhead
Therefore I search for an integral script for removal of the metadata from JPEG
Such question, and it is possible using exiftool to remove all metadata except exif?
Quote from: lorents on February 21, 2012, 01:41:26 PM
Such question, and it is possible using exiftool to remove all metadata except exif?
Yes.
It is possible more in detail, how?
exiftool -all= --exif:all FILE
Thanks!
And there are no chances, what you separate from exiftool function of removal of the metadata for JPEG?
Aside from the script I posted, I have no plans to write another script that only removes metadata.
- Phil
It is a pity, if will change the mind, let know.
exiftool the excellent program, I wish the further development.
Tell me, what removes the tags Photoshop in ExifToolGUI?
This option executes command
exiftool -photoshop:all=
-which deletes photoshop metadata section in selected files (see description here: http://www.exiftool.org/TagNames/Photoshop.html
Bogdan
thanks
Phil Harvey good afternoon!
I have some questions, you couldn't answer them:
1. How to remove the comment from JPEG
2. How to apply date and time of updating of a file from EXIF
3. Whether it is possible to receive the unpacked version exiftool since I lose a lot of time for unpacking exiftool, and whether it is possible then to clean from exiftool scripts which aren't responsible for work with JPEG?
Quote from: lorents on February 23, 2012, 05:22:27 AM
1. How to remove the comment from JPEG
-comment=Quote2. How to apply date and time of updating of a file from EXIF
"-filemodifydate<datetimeoriginal"Quote3. Whether it is possible to receive the unpacked version exiftool since I lose a lot of time for unpacking exiftool,
You can install Perl and run the Perl version if you want. All versions are available from the exiftool home page.
Quoteand whether it is possible then to clean from exiftool scripts which aren't responsible for work with JPEG?
You are free to edit ExifTool to suit your needs. Full source code is included in all versions.
- Phil
How it is possible to make removal of all metadata except the comment?
Whether could make you an example of work ExifTool with ActivePerl, I will be very grateful? At the same time to remove all superfluous of ExifTool?
Me following functions interest
-all=
-exif:all=
-iptc:all=
-xmp:all=
-icc_profile:all=
-photoshop:all=
-comment=
--exif:all
--iptc:all
--xmp:all
--icc_profile:all
--photoshop:all
--comment
-overwrite_original
"-filemodifydate<datetimeoriginal"
Quote from: lorents on February 23, 2012, 11:05:05 AM
How it is possible to make removal of all metadata except the comment?
I think it is time you read the documentation (https://exiftool.org/exiftool_pod.html). Look for "--TAG".
QuoteWhether could make you an example of work ExifTool with ActivePerl, I will be very grateful? At the same time to remove all superfluous of ExifTool?
"Aside from the script I posted, I have no plans to write another script that only removes metadata."
- Phil
I to tell the truth, and haven't understood as to remove all data from JPEG, except the comment. Tried so - comment, but hasn't helped.
Try this:
exiftool -all= -tagsfromfile @ -comment FILE
as per the documentation.
- Phil
Thanks big!
Also it is possible to ask last question
Than differ then
-all= -tagsfromfile @ -exif -xmp
From
-all= -exif:all -xmp:all
Quote from: lorents on February 24, 2012, 07:32:59 AM
Than differ then
-all= -tagsfromfile @ -exif -xmp
From
-all = -exif:all -xmp:all
Do you mean
-all= --exif:all --xmp:all ?
The first command is slower because it extracts the EXIF and XMP from the file then writes it back again, replacing the original EXIF and XMP. My version of the 2nd command deletes everything except the EXIF and XMP.
- Phil
Whether correctly I have understood you, it is better to use a command
-all= -exif:all -xmp:all
It works faster?
-all= --exif:all --xmp:all
Yes.
Thank you very much!