Hello all! I have a script that downloads the photos from a SD-card into a directory created with the date of "downloading". It then calls a second script that converts all the raw files to jpeg and place them in two sub folders under the parent. One for full size, and one for reduced. My problem: I dont preserve exif data with the current script. I need to extend it and i dont know how. I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags? #!/bin/sh echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done /Rikard Johnels
Rikard Johnels wrote:
Hello all! I have a script that downloads the photos from a SD-card into a directory created with the date of "downloading". It then calls a second script that converts all the raw files to jpeg and place them in two sub folders under the parent. One for full size, and one for reduced.
My problem: I dont preserve exif data with the current script. I need to extend it and i dont know how.
I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags?
#!/bin/sh echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done
In your script you use dcraw and cjpeg. I don't believe these preserve exif data. However I do know that convert from ImageMagick does. Also, I believe convert can read, but not write, PEF files. So, why not just use convert? Ed -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Ed Greshko wrote:
Rikard Johnels wrote:
Hello all! I have a script that downloads the photos from a SD-card into a directory created with the date of "downloading". It then calls a second script that converts all the raw files to jpeg and place them in two sub folders under the parent. One for full size, and one for reduced.
My problem: I dont preserve exif data with the current script. I need to extend it and i dont know how.
I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags?
#!/bin/sh echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done
In your script you use dcraw and cjpeg. I don't believe these preserve exif data. However I do know that convert from ImageMagick does. Also, I believe convert can read, but not write, PEF files. So, why not just use convert?
When I wrote the above I didn't have a PEF file. I found an example, which I believe is OK, and used convert to transform it into a jpeg. While some conversions do preserve exif data, this conversion does not. I believe it because one underlying utility ufraw doesn't preserve the exif data. So, yes, it seems your idea to first use exiftool to read the exif data from the pef file first and write it back to the jpeg file at the end would be your best option. -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Ed Greshko <Ed.Greshko@greshko.com> [01-01-70 12:34]:
When I wrote the above I didn't have a PEF file. I found an example, which I believe is OK, and used convert to transform it into a jpeg. While some conversions do preserve exif data, this conversion does not. I believe it because one underlying utility ufraw doesn't preserve the exif data.
ufraw does indeed preserve exif data when converting to jpeg format, and would be a nearly direct replacement into his script. from TFM: Output Options The options which are related to the final output are: --[no]exif Embed exif in output JPEG. Default embed exif. Exif information can only be embedded in jpeg-files. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Patrick Shanahan wrote:
* Ed Greshko <Ed.Greshko@greshko.com> [01-01-70 12:34]:
When I wrote the above I didn't have a PEF file. I found an example, which I believe is OK, and used convert to transform it into a jpeg. While some conversions do preserve exif data, this conversion does not. I believe it because one underlying utility ufraw doesn't preserve the exif data.
ufraw does indeed preserve exif data when converting to jpeg format, and would be a nearly direct replacement into his script.
from TFM:
Output Options The options which are related to the final output are:
--[no]exif Embed exif in output JPEG. Default embed exif. Exif information can only be embedded in jpeg-files.
Hummm.... It did not work for me.... -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Ed Greshko wrote:
Patrick Shanahan wrote:
* Ed Greshko <Ed.Greshko@greshko.com> [01-01-70 12:34]:
When I wrote the above I didn't have a PEF file. I found an example, which I believe is OK, and used convert to transform it into a jpeg. While some conversions do preserve exif data, this conversion does not. I believe it because one underlying utility ufraw doesn't preserve the exif data.
ufraw does indeed preserve exif data when converting to jpeg format, and would be a nearly direct replacement into his script.
from TFM:
Output Options The options which are related to the final output are:
--[no]exif Embed exif in output JPEG. Default embed exif. Exif information can only be embedded in jpeg-files.
Hummm.... It did not work for me....
Oh, I suppose it would be helpful to state that "convert" calls ufraw which lead me to that assumption. (Yes, bad.) I really didn't have too much time to experiment...but it would seem that "convert" only preserves exif data when operating between the same image type. -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Ed Greshko <Ed.Greshko@greshko.com> [03-03-10 10:21]:
Oh, I suppose it would be helpful to state that "convert" calls ufraw which lead me to that assumption. (Yes, bad.) I really didn't have too much time to experiment...but it would seem that "convert" only preserves exif data when operating between the same image type.
But the OP was not using "convert" to change from his raw format to jpg, he was using dcraw. You are making unnecessary changes to his script. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Patrick Shanahan wrote:
* Ed Greshko <Ed.Greshko@greshko.com> [03-03-10 10:21]:
Oh, I suppose it would be helpful to state that "convert" calls ufraw which lead me to that assumption. (Yes, bad.) I really didn't have too much time to experiment...but it would seem that "convert" only preserves exif data when operating between the same image type.
But the OP was not using "convert" to change from his raw format to jpg, he was using dcraw. You are making unnecessary changes to his script.
I suppose you've never tried to solve a problem in a different way? At the point where I first looked at it, I just wondered why the OP hadn't used convert to being with. In any event, his script didn't do as he wanted and I did provide an answer using exiftool. Maybe you can suggest what he needs to change in his script, using only the commands he had in it, to provide him with the results he desired. That would seem to be time better spent than debating me. :-) -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Ed Greshko <Ed.Greshko@greshko.com> [03-03-10 13:15]:
Patrick Shanahan wrote:
But the OP was not using "convert" to change from his raw format to jpg, he was using dcraw. You are making unnecessary changes to his script.
I suppose you've never tried to solve a problem in a different way?
certainly, but not the point, in this case.
At the point where I first looked at it, I just wondered why the OP hadn't used convert to being with.
I saw that you suggested "convert", but then remarked that when changing formats the exif data was not transferred. But you then remarked that ufraw (ufraw-batch) would not.
In any event, his script didn't do as he wanted and I did provide an answer using exiftool.
a workable solution, I believe.
Maybe you can suggest what he needs to change in his script, using only the commands he had in it, to provide him with the results he desired.
I did, replacing dcraw with ufraw-batch. I did not research the different parameters necessary, but: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #!/bin/sh echo find -type f |wc -l images to convert. for x in ls *.pef | cut -d. -f1 do ## dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg ufraw-batch --out-type jpeg --compression 90 --out-path \ ./converted/big/ --output=$x.jpeg $x.pef convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - should be close, not tested. And uses one less call and no pipe. Note the broken line, also that the script as presented works on files in the pwd.
That would seem to be time better spent than debating me. :-)
An argument of points, but debate? It's not a personal thing. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Patrick Shanahan wrote:
That would seem to be time better spent than debating me. :-)
An argument of points, but debate? It's not a personal thing.
Hence the smiley face...... -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Ed Greshko <Ed.Greshko@greshko.com> [03-03-10 10:15]:
Patrick Shanahan wrote:
ufraw does indeed preserve exif data when converting to jpeg format, and would be a nearly direct replacement into his script.
from TFM:
Output Options The options which are related to the final output are:
--[no]exif Embed exif in output JPEG. Default embed exif. Exif information can only be embedded in jpeg-files.
Hummm.... It did not work for me....
openSUSE 11.2 x86_64 ufraw-0.15-7.1.x86_64 dcraw-8.98-7.1.x86_64 ufraw-batch --help --[no]exif Embed EXIF in output JPEG or PNG (default embed EXIF). works for me. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Patrick Shanahan wrote:
* Ed Greshko <Ed.Greshko@greshko.com> [03-03-10 10:15]:
Patrick Shanahan wrote:
ufraw does indeed preserve exif data when converting to jpeg format, and would be a nearly direct replacement into his script.
from TFM:
Output Options The options which are related to the final output are:
--[no]exif Embed exif in output JPEG. Default embed exif. Exif information can only be embedded in jpeg-files.
Hummm.... It did not work for me....
openSUSE 11.2 x86_64 ufraw-0.15-7.1.x86_64 dcraw-8.98-7.1.x86_64
ufraw-batch --help --[no]exif Embed EXIF in output JPEG or PNG (default embed EXIF).
works for me.
Yes. I'm sure I caused some confusion by not typing it "convert" as in the ImageMagick "convert". -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/02/2010 03:36 PM, Rikard Johnels wrote:
I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags?
Richard, Use 'jhead' instead of exiftool. jhead is written in c and 5X faster than exiftool (perl). You can customize the jhead source easily -- as long as you like weeding through 50 nested 'if' statements. Both jhead and exiftool will allow you to add the exif data to the jpegs you create. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
On 03/02/2010 03:36 PM, Rikard Johnels wrote:
I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags?
Richard,
Use 'jhead' instead of exiftool. jhead is written in c and 5X faster than exiftool (perl). You can customize the jhead source easily -- as long as you like weeding through 50 nested 'if' statements. Both jhead and exiftool will allow you to add the exif data to the jpegs you create.
jhead seems nice.... But it also seems to only manipulate the exif data in jpeg files. The OP's original files are PEF files. This is a RAW image data produced by Pentax cameras. I believe the OP wants to preserve the camera information and other information in the resulting jpeg files. I don't see how jhead help in his case. -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/02/2010 08:59 PM, Ed Greshko wrote:
David C. Rankin wrote:
On 03/02/2010 03:36 PM, Rikard Johnels wrote:
jhead seems nice.... But it also seems to only manipulate the exif data in jpeg files. The OP's original files are PEF files. This is a RAW image data produced by Pentax cameras. I believe the OP wants to preserve the camera information and other information in the resulting jpeg files. I don't see how jhead help in his case.
I stand corrected. You got me there. Will exiftool extract the data from raw? I'll have to look it up. I've used both jhead and exiftool and both are good. However when I was readying the family pictures to move into gallery2 and organizing the layout by picture taken date, jhead cut the time to parse and organize the 8,000+ photos to only a few minutes while exiftool was taking nearly 1/2 hour. Thanks Ed -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
On 03/02/2010 08:59 PM, Ed Greshko wrote:
David C. Rankin wrote:
On 03/02/2010 03:36 PM, Rikard Johnels wrote:
jhead seems nice.... But it also seems to only manipulate the exif data in jpeg files. The OP's original files are PEF files. This is a RAW image data produced by Pentax cameras. I believe the OP wants to preserve the camera information and other information in the resulting jpeg files. I don't see how jhead help in his case.
I stand corrected. You got me there. Will exiftool extract the data from raw?
Yes, it does. I tested it before suggesting the command to use as I wasn't sure either.
I'll have to look it up.
I've used both jhead and exiftool and both are good. However when I was readying the family pictures to move into gallery2 and organizing the layout by picture taken date, jhead cut the time to parse and organize the 8,000+ photos to only a few minutes while exiftool was taking nearly 1/2 hour.
Thanks Ed
Welcome... -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Rikard Johnels wrote:
Hello all! I have a script that downloads the photos from a SD-card into a directory created with the date of "downloading". It then calls a second script that converts all the raw files to jpeg and place them in two sub folders under the parent. One for full size, and one for reduced.
My problem: I dont preserve exif data with the current script. I need to extend it and i dont know how.
I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags?
#!/bin/sh echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done
Sorry for the multiple posts on this.... I blame it on "no coffee" yet.... Give this a try.... dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg exiftool -TagsFromFile $x.pef -all:all converted/big/$x.jpeg Please note that the exiftool command shown above will rewrite the $x.pef and retain the old file as $x.pef.original. Also, the convert to scale the image will retain the exif data. This "should" transfer all the exif tags from the pef file to the jpeg file. You may want to adjust which tags are transfered. -- 葛斯克 愛德華 / 台北市八德路四段 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello all! I have a script that downloads the photos from a SD-card into a directory created with the date of "downloading". It then calls a second script that converts all the raw files to jpeg and place them in two sub folders under the parent. One for full size, and one for reduced.
My problem: I dont preserve exif data with the current script. I need to extend it and i dont know how.
I planed to use exiftool as it gives me every tag i want in its default state. But how do i make the script preserve the tags?
#!/bin/sh echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do dcraw -f -c $x.pef | cjpeg -quality 90 > converted/big/$x.jpeg convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done
/Rikard Johnels
After reading through some of the helpful tips i got, i mangled my script to look like this: #!/bin/sh echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do ufraw-batch --out-type jpeg --compression=95 --exif \ --out-path=./converted/big $x.pef ufraw-batch --out-type jpeg --compression=95 --exif \ --out-path=./converted/small --shrink=5 $x.pef touch -r $x.pef converted/big/$x.jpg converted/small/$x.jpg done It may not be elegant, and it aint all that fast especially when i convert some 90 images in a row, but it gets the work done. As stated before; I am (sadly) NOT fluent in any script writing, so i wing it... Anyone have a nicer, faster way to convert please feel free to show us how you did it. /Rikard Johnels
* Rikard Johnels <rikard.j@rikjoh.com> [03-03-10 14:43]:
convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done
/Rikard Johnels
After reading through some of the helpful tips i got, i mangled my script to look like this:
#!/bin/sh
echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do ufraw-batch --out-type jpeg --compression=95 --exif \ --out-path=./converted/big $x.pef
convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg ## ufraw-batch --out-type jpeg --compression=95 --exif \ --out-path=./converted/small --shrink=5 $x.pef
touch -r $x.pef converted/big/$x.jpg converted/small/$x.jpg done
It may not be elegant, and it aint all that fast especially when i convert some 90 images in a row, but it gets the work done. As stated before; I am (sadly) NOT fluent in any script writing, so i wing it...
Anyone have a nicer, faster way to convert please feel free to show us how you did it.
** Should be faster as it takes less time to resize a jpeg than to convert from raw to jpeg, *and* should (you need to check) retain the exif information. Glad you have something workable. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Rikard Johnels <rikard.j@rikjoh.com> [03-03-10 14:43]:
convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg touch -r $x.pef converted/big/$x.jpeg converted/small/$x.jpeg done
/Rikard Johnels
After reading through some of the helpful tips i got, i mangled my script to look like this:
#!/bin/sh
echo `find -type f |wc -l` images to convert. for x in `ls *.pef | cut -d. -f1` do ufraw-batch --out-type jpeg --compression=95 --exif \ --out-path=./converted/big $x.pef
convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg
## ufraw-batch --out-type jpeg --compression=95 --exif \ --out-path=./converted/small --shrink=5 $x.pef
touch -r $x.pef converted/big/$x.jpg converted/small/$x.jpg done
It may not be elegant, and it aint all that fast especially when i convert some 90 images in a row, but it gets the work done. As stated before; I am (sadly) NOT fluent in any script writing, so i wing it...
Anyone have a nicer, faster way to convert please feel free to show us how you did it.
** Should be faster as it takes less time to resize a jpeg than to convert from raw to jpeg, *and* should (you need to check) retain the exif information.
Glad you have something workable. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org
Does that rewrite the exif size tags on the reduced images too? Or do i have to rewrite them manually? /Rikard Johnels
* Rikard Johnels <rikard.j@rikjoh.com> [03-03-10 16:36]:
Does that rewrite the exif size tags on the reduced images too? Or do i have to rewrite them manually?
I *believe* that convert will retain the exif info *unless* you change the image format. Just tested the "convert", convert -scale 20% image.jpeg image1.jpeg The resultant exif data is sligtly different, but minimally past the image size and date data. -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Rikard Johnels wrote:
convert -scale 20% converted/big/$x.jpeg converted/small/$x.jpeg
** Should be faster as it takes less time to resize a jpeg than to convert from raw to jpeg, *and* should (you need to check) retain the exif information.
Does that rewrite the exif size tags on the reduced images too? Or do i have to rewrite them manually?
This is a "What happened when you tried it?" question. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (5)
-
Brian K. White
-
David C. Rankin
-
Ed Greshko
-
Patrick Shanahan
-
Rikard Johnels