how do I rotate image and strip meta using convert?
-
- Posts: 6
- Joined: 2019-01-03T12:18:07-07:00
- Authentication code: 1152
how do I rotate image and strip meta using convert?
I am using convert to create a new image, rotate and striping meta info but it fails to rotate when using -strip. I assume because strip removed the EXIF:orientation. So
magick convert "IMG_20180830_110737.jpg" -rotate 180 -strip "new_IMG_20180830_110737-4.jpg" results in image not being rotated and removing -strip results in rotated image with meta info.
how do I accomplish both?
using Version: ImageMagick 7.0.7-31 Q16 x64 2018-05-07
magick convert "IMG_20180830_110737.jpg" -rotate 180 -strip "new_IMG_20180830_110737-4.jpg" results in image not being rotated and removing -strip results in rotated image with meta info.
how do I accomplish both?
using Version: ImageMagick 7.0.7-31 Q16 x64 2018-05-07
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how do I rotate image and strip meta using convert?
There is no reason that -rotate 180 would not work. You already have -strip after it, which is proper. However, your viewer may be seeing the EXIF orientation and automatically correcting it. But then your rotate and strip and get back to the original orientation.
If the EXIF data has orientation information, then just use -auto-orient.
For IM 7, use magick, not magick convert and not convert.
If the EXIF data has orientation information, then just use -auto-orient.
For IM 7, use magick, not magick convert and not convert.
Code: Select all
magick "IMG_20180830_110737.jpg" -auto-orient -strip "new_IMG_20180830_110737-4.jpg"
Re: how do I rotate image and strip meta using convert?
You could use the auto-orient option of convert to do this. Also Don't forget you can use mogrify instead of convert if you want to replace the existing file (in-place), which is useful when you want to do a directory full.
-
- Posts: 6
- Joined: 2019-01-03T12:18:07-07:00
- Authentication code: 1152
Re: how do I rotate image and strip meta using convert?
So I tried your code and it doesn't rotate, image still upside down. Tried this and didn't work either.fmw42 wrote: ↑2019-01-03T15:43:11-07:00 There is no reason that -rotate 180 would not work. You already have -strip after it, which is proper. However, your viewer may be seeing the EXIF orientation and automatically correcting it. But then your rotate and strip and get back to the original orientation.
If the EXIF data has orientation information, then just use -auto-orient.
For IM 7, use magick, not magick convert and not convert.
Code: Select all
magick "IMG_20180830_110737.jpg" -auto-orient -strip "new_IMG_20180830_110737-4.jpg"
Code: Select all
magick "IMG_20180830_110737.jpg" -rotate 180 -strip "new_IMG_20180830_110737-4.jpg"
Odd thing is on SOME when I used only -strip the image rotated automagically but only on some. Go figure!
If I use windows explorer to rotate the image, I notice EXIF orientation is added, I then use -strip and image is upside down again.
If I use irfanviewer to rotate no exif data is added and image stays rotated.
Last edited by newbie_user on 2019-01-03T23:53:00-07:00, edited 1 time in total.
-
- Posts: 6
- Joined: 2019-01-03T12:18:07-07:00
- Authentication code: 1152
Re: how do I rotate image and strip meta using convert?
mogrify isn't and option as I have to keep the original files unmodified and I cant get -auto-orient to work at all. I'm open to other ideas thou.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how do I rotate image and strip meta using convert?
Post one of your images that seems to have issues. Perhaps there is no EXIF orientation in the file.
-
- Posts: 6
- Joined: 2019-01-03T12:18:07-07:00
- Authentication code: 1152
Re: how do I rotate image and strip meta using convert?
both images are orientated with EXIF:Bottom Right and taken with same camera.
irfran and windows (thumbnail) show same orientation (on originals) and varies on modified
strip flips correctly but rotate strip does not -
Image 1 - Originally orients upside down on my PC
https://imagebin.ca/v/4SNDUUUchVf3
strips and flips
strips and no flip
does not work (does do something to Image 2)
Already orientated correctly so strip should just remove the EXIF but -strip flips the image upside down.
Image 2 - Original orients correctly on my PC
https://imagebin.ca/v/4SNEsfAU7cve
strips and flips (wrong)
strips and flips
works (windows thumbnail is upside down, exif shows top left now)
Thanks for the help, very appreciated
irfran and windows (thumbnail) show same orientation (on originals) and varies on modified
strip flips correctly but rotate strip does not -
Image 1 - Originally orients upside down on my PC
https://imagebin.ca/v/4SNDUUUchVf3
strips and flips
Code: Select all
magick image1.jpg -strip newimage1-1.jpg
strips and no flip
Code: Select all
magick image1.jpg -rotate 180 -strip newimage1-2.jpg
does not work (does do something to Image 2)
Code: Select all
magick image1.jpg -auto-orient newimage1-3.jpg
Already orientated correctly so strip should just remove the EXIF but -strip flips the image upside down.
Image 2 - Original orients correctly on my PC
https://imagebin.ca/v/4SNEsfAU7cve
strips and flips (wrong)
Code: Select all
magick image2.jpg -strip newimage2-1.jpg
strips and flips
Code: Select all
magick image2.jpg -rotate 180 -strip newimage2-2.jpg
works (windows thumbnail is upside down, exif shows top left now)
Code: Select all
magick image2.jpg -auto-orient newimage2-3.jpg
Thanks for the help, very appreciated
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how do I rotate image and strip meta using convert?
Both these work fine for me on IM 7.0.8.23 Q16 Mac OSX
Thumbnails look correct on my Mac.
Code: Select all
magick image.jpg -auto-orient image2.jpg
Code: Select all
magick image.jpg -auto-orient -strip image3.jpg
-
- Posts: 6
- Joined: 2019-01-03T12:18:07-07:00
- Authentication code: 1152
Re: how do I rotate image and strip meta using convert?
I installed Version: ImageMagick 7.0.8-23 Q16 x64 2019-01-02 (dll) on clean windows 10 pro and still does not work.
I downloaded image1 and image2 from above and noticed imagebin has image 1 right side up and image 2 upside down.
This is opposite to what PC shows. Verified the both downloaded images are still set to bottom right as well.
I downloaded image1 and image2 from above and noticed imagebin has image 1 right side up and image 2 upside down.
This is opposite to what PC shows. Verified the both downloaded images are still set to bottom right as well.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how do I rotate image and strip meta using convert?
Yes, for me your first image does not work properly with -auto-orient. But the second image does work fine for me on IM 7.0.8.23 Q16 Mac OSX. I do verify that both images have EXIF:orientation of 3.
I am not sure what is wrong. A guess would be something odd in your file.
I am not sure what is wrong. A guess would be something odd in your file.