-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orientation of some images is incorrect #2972
Comments
Is there anyone who could provide some insight on this? I've taken a look at the EXIF data and I can't see any difference between this photo and another that is oriented correctly |
I spent the last hour trying to figure it out and I actually don't know. EXIF orientation is being correctly decoded, and in the PDF the image has correct dimensions. Seems to be something on how it's encoded that makes it render incorrectly. JPEG viewers seems to be understanding it, but couldn't figure out what it is. I'll leave this open in case someone else with more experience on JPEG format knows. I recommend re-encoding the image |
I encountered the same issue in a Next.js project. I noticed a brief flicker of the correct image during hot reloading, which led me to this workaround: // ...
const [data, setData] = useState<DataInterface | null>(null);
useEffect(() => {
// ...
setData(data);
setTimeout(() => { setData(null); setTimeout(() => { setData(data) }, 1) }, 1);
}, []);
return (
{data &&
(<PDFViewer>
<Document>
<Page>
<View>
<Image src="https://example.com/image.jpg" />
// ...
); The trick seems to be conditionally rendering the PDF and triggering a second render. Without the workaround: With the workaround: Please ignore the red numbered circles as they are absolute-positioned and placed on top of the image. |
@giancarlo-cf thank you, this workaround worked for me too |
Describe the bug
Some images are rendered with the incorrect orientation (i.e. rotated 90 CCW)
To Reproduce
Try to render this file
Expected behavior
The image should be rendered the same way as when you open the file in an image viewer
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: