I can't open the jpeg file saved in screenshot of Puppeteer.

Asked 1 years ago, Updated 1 years ago, 78 views

Running Puppeteer in node.js.

I accessed Google's top page with the following code and saved the screenshot as a jpg file.

const supplier=require('puppeter');

browser = wait supplier.launch({headless:false});

const page = wait browser.newPage();
consturl='https://www.google.com';
wait page.goto(url, {waitUntil:'networkidle0'});
wait page.screenshot({type:'jpeg', path:'ss.jpg'});


Save Files Double-click
on a Windows 8.1 PC. Windows Photo Viewer will launch.
"This image cannot be viewed in Windows Photo Viewer.There may not be enough memory available."
This error is similar to the one shown in .

As we open another file with a larger file size than ss.jpg (not created by papeteer), we have determined that memory-unpressed error messages are not affected.

Also, when you open ss.jpg on a slide show, you can see the image.
If you drag and drop ss.jpg into Chrome's browser, the image will also appear.

Although it has been established as a jpg file, it cannot be opened only with certain software (Windows Photo Viewer).

wait page.screenshot({type:'jpeg', path:'ss.jpg'});

the part of wait page.screenshot({type:'png', path:'ss.png'});

if You can also open ss.png in Windows Photo Viewer.

'https://www.google.com'
The same phenomenon occurs when screenshots are taken at a URL other than .

When I save jpg, the image is not displayed.
Image is displayed when png is saved.
jpg also displays images on slideshows and browsers.

Other than the image saved in papeter, jpg is displayed without any problems, so I understand that it is a problem on the papeter side.

Please let me know if you have any idea about the problem that the jpg file cannot be opened only with certain software.

For now,
·Isn't there a version or codec in jpeg itself?
·What version of jpeg can be handled in Puppeteer or Windows Photo Viewer?
I'm looking into it with the assumption that

ss.jpg

javascript windows image puppeteer photoshop

2022-09-30 11:45

1 Answers

Half solved, so answer yourself.

Rewrite ICC_PROFILE to ICC_PROFILX using the link below.
The ss.jpg is now open in Windows Photo Viewer.
https://www.pcreview.co.uk/threads/windows-photo-viewer-can%E2%80%99t-display-this-picture-because-there-might-not-be-enough-memory-available-on-your-computer.4075896/

Specific Steps
·Install a plug-in called Hex Editor in Visual Studio Code
·Right-click ss.jpg in Visual Studio Code > Open With > Hex Editor
·Find the ICC_PROFILE character from ss.jpg opened in Hex Editor and rewrite it to ICC_PROFILEX (rewrite E to X)

ICC_PROFILE doesn't seem to open the file in Windows Photo Viewer.

Close this once and not as a papeteer question
I would like to ask you a separate question from the perspective of "javascript and ICC_PROFILE".


2022-09-30 11:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.