ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Rotating jpeg image gives weird output
@ 2022-06-14  8:56 Denis Maier via ntg-context
  2022-06-14  9:45 ` Max Chernoff via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Maier via ntg-context @ 2022-06-14  8:56 UTC (permalink / raw)
  To: ntg-context; +Cc: denis.maier


[-- Attachment #1.1: Type: text/plain, Size: 779 bytes --]

Hi,

I have a jpeg image that drives me crazy. The scanned image I have received from the author is in landscape. So, I've rotated the image, but now two things happen:

1. there's a weird offset (the image is moved to the right)
2. The output contains this line
. location=local,global. location=local,global

I'm not quite quite sure how I can produce a MWE that shows the problem, but has anyone ever seen something like this? Does anyone know what that < . location=local,global. location=local,global > stuff means?

Best,
Denis

P.S: I've performed the rotations using the standard picture editor on Windows and with GIMP. Happens with both tools.l
P.S.S.: This seems to be somehow related to the particular file. With a different file that does not happen.

[-- Attachment #1.2: Type: text/html, Size: 2919 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Rotating jpeg image gives weird output
  2022-06-14  8:56 Rotating jpeg image gives weird output Denis Maier via ntg-context
@ 2022-06-14  9:45 ` Max Chernoff via ntg-context
  2022-06-14 10:47   ` Denis Maier via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Max Chernoff via ntg-context @ 2022-06-14  9:45 UTC (permalink / raw)
  To: ntg-context; +Cc: Max Chernoff

> So, I've rotated the image, but now two things happen:
> 
> 1. there's a weird offset (the image is moved to the right)
>
> This seems to be somehow related to the particular file. With a different
> file that does not happen.

This can sometimes happen if the image has an embedded EXIF
"Orientation" tag and you're using a buggy viewer. Really old versions
of Firefox/pdf.js had this bug. If this is the case, you should be able
to reproduce it with the following bash commands:

     convert -size 64x256 canvas:grey -fill black -draw "circle 32,128 16,112" demo1.jpg
     exiftool -Orientation='Rotate 90 CW' demo1.jpg -o demo2.jpg

Then, include "demo1.jpg" and "demo2.jpg" in a ConTeXt file using
\externalfigure. Both pictures should display as circles; if you get
ovals, then it's definitely EXIF-related.

> 2. The output contains this line
> . location=local,global. location=local,global

Never seen this before, which makes me suspect that maybe this isn't
EXIF-related. Maybe the image is just subtly corrupted?

Anyways, if the problem is EXIF-related, then opening and saving the image
file with MS Paint (or any other non-EXIF-aware editor) should fix things.
Otherwise, I have no suggestions.

-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Rotating jpeg image gives weird output
  2022-06-14  9:45 ` Max Chernoff via ntg-context
@ 2022-06-14 10:47   ` Denis Maier via ntg-context
  2022-06-14 22:52     ` Max Chernoff via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Denis Maier via ntg-context @ 2022-06-14 10:47 UTC (permalink / raw)
  To: mseven, ntg-context; +Cc: denis.maier

Thanks for your suggestions.

It probably is not EXIF-related. I've opened and saved the image with MS Paint, but that did not change anything (the increase in file size aside...).

Any other ideas? (I tend to think the image is corrupted in one way or the other, but I have no clue how to fix that.)

Best,
Denis

> -----Ursprüngliche Nachricht-----
> Von: Max Chernoff <mseven@telus.net>
> Gesendet: Dienstag, 14. Juni 2022 11:45
> An: ntg-context@ntg.nl
> Cc: Maier, Denis Christian (UB) <denis.maier@unibe.ch>
> Betreff: Re: [NTG-context] Rotating jpeg image gives weird output
> 
> > So, I've rotated the image, but now two things happen:
> >
> > 1. there's a weird offset (the image is moved to the right)
> >
> > This seems to be somehow related to the particular file. With a
> > different file that does not happen.
> 
> This can sometimes happen if the image has an embedded EXIF "Orientation"
> tag and you're using a buggy viewer. Really old versions of Firefox/pdf.js had
> this bug. If this is the case, you should be able to reproduce it with the
> following bash commands:
> 
>      convert -size 64x256 canvas:grey -fill black -draw "circle 32,128 16,112"
> demo1.jpg
>      exiftool -Orientation='Rotate 90 CW' demo1.jpg -o demo2.jpg
> 
> Then, include "demo1.jpg" and "demo2.jpg" in a ConTeXt file using
> \externalfigure. Both pictures should display as circles; if you get ovals, then
> it's definitely EXIF-related.
> 
> > 2. The output contains this line
> > . location=local,global. location=local,global
> 
> Never seen this before, which makes me suspect that maybe this isn't EXIF-
> related. Maybe the image is just subtly corrupted?
> 
> Anyways, if the problem is EXIF-related, then opening and saving the image
> file with MS Paint (or any other non-EXIF-aware editor) should fix things.
> Otherwise, I have no suggestions.
> 
> -- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Rotating jpeg image gives weird output
  2022-06-14 10:47   ` Denis Maier via ntg-context
@ 2022-06-14 22:52     ` Max Chernoff via ntg-context
  2022-06-15 11:44       ` Denis Maier via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Max Chernoff via ntg-context @ 2022-06-14 22:52 UTC (permalink / raw)
  To: denis.maier, ntg-context; +Cc: Max Chernoff

> Any other ideas? (I tend to think the image is corrupted in one way or the other, but I have no clue how to fix that.)

You could try making a new image with the same content. Assuming you're 
on Windows 10/11, install Image Magick

     winget install -e --id ImageMagick.ImageMagick

then run

     magick convert -strip image.jpg temp.tga
     magick convert -strip temp.tga new-image.jpg
     del temp.tga

which should give you a new image "new-image.jpg" that shouldn't be 
corrupt. If you are still having problems with this new image, then the 
issue is likely with ConTeXt itself, and this specific image is just 
triggering it somehow.

-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Rotating jpeg image gives weird output
  2022-06-14 22:52     ` Max Chernoff via ntg-context
@ 2022-06-15 11:44       ` Denis Maier via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Denis Maier via ntg-context @ 2022-06-15 11:44 UTC (permalink / raw)
  To: mseven, ntg-context; +Cc: denis.maier

Thanks for all your help. Using Magick had no effect so I've had another look at my setup. It turned out I had this in m

\setupexternalfigures
  [maxwidth=\textwidth,
  maxheight=0.8\textheight.
  location={local,global},
]

The period to end maxheight is obviously a mistake. (However, I'm still perplexed that this only shows up when the image is rotated...)

Sorry for the noise.

Denis

> -----Ursprüngliche Nachricht-----
> Von: Max Chernoff <mseven@telus.net>
> Gesendet: Mittwoch, 15. Juni 2022 00:52
> An: Maier, Denis Christian (UB) <denis.maier@unibe.ch>; ntg-context@ntg.nl
> Betreff: Re: [NTG-context] Rotating jpeg image gives weird output
> 
> > Any other ideas? (I tend to think the image is corrupted in one way or
> > the other, but I have no clue how to fix that.)
> 
> You could try making a new image with the same content. Assuming you're
> on Windows 10/11, install Image Magick
> 
>      winget install -e --id ImageMagick.ImageMagick
> 
> then run
> 
>      magick convert -strip image.jpg temp.tga
>      magick convert -strip temp.tga new-image.jpg
>      del temp.tga
> 
> which should give you a new image "new-image.jpg" that shouldn't be
> corrupt. If you are still having problems with this new image, then the issue is
> likely with ConTeXt itself, and this specific image is just triggering it
> somehow.
> 
> -- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-15 11:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14  8:56 Rotating jpeg image gives weird output Denis Maier via ntg-context
2022-06-14  9:45 ` Max Chernoff via ntg-context
2022-06-14 10:47   ` Denis Maier via ntg-context
2022-06-14 22:52     ` Max Chernoff via ntg-context
2022-06-15 11:44       ` Denis Maier via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).