Unable to save screenshots and world icons if the path contains non-ASCII characters
The bug
Taking a screenshot fails when the folder of your game profile contains non-ASCII characters.
[22:40:50] [Client thread/WARN]: Couldn't save screenshot
java.io.IOException: Could not write image to the PNG file "###\screenshots\2018-02-11_22.40.50.png": Corrupt JPEG
at csp.a(SourceFile:306) ~[18w06a.jar:?]
at bxc.a(SourceFile:45) ~[18w06a.jar:?]
at bxc.a(SourceFile:30) ~[18w06a.jar:?]
at bwu.a(SourceFile:256) ~[18w06a.jar:?]
at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?]
at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?]
at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?]
at bwx.b(SourceFile:803) [18w06a.jar:?]
at bwx.a(SourceFile:383) [18w06a.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]
Additionally world icons cannot be saved either.
[22:45:42] [Client thread/WARN]: Couldn't save auto screenshot
java.io.IOException: Could not write image to the PNG file "###\saves\New World\icon.png": Corrupt JPEG
at csp.a(SourceFile:306) ~[18w06a.jar:?]
at cjr.n(SourceFile:1039) [18w06a.jar:?]
at cjr.a(SourceFile:949) [18w06a.jar:?]
at bwx.b(SourceFile:823) [18w06a.jar:?]
at bwx.a(SourceFile:383) [18w06a.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]
Besides the profile name also having non-ascii chars in the world name triggers that issue:
java.io.IOException: Could not write image to the PNG file "D:\mc\mn\bugs\.minecraft\saves\����BUG\icon.png": Corrupt JPEG
at deq.a(SourceFile:306) ~[18w20b.jar:?]
at cvd.o(SourceFile:870) [18w20b.jar:?]
at cvd.a(SourceFile:783) [18w20b.jar:?]
at cht.c(SourceFile:820) [18w20b.jar:?]
at cht.a(SourceFile:381) [18w20b.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:144) [18w20b.jar:?]
How to reproduce
- Create a folder whose name contains non-ASCII characters, for example the following
äö²³§ß
- Launch Minecraft with this folder as game directory
- Try to take a screenshot
Code analysis
Code analysis by [Mod] Pokechu22 can be found in this comment.
Linked Issues
is duplicated by9
Created Issue:
Unable to save screenshot of PNG format
When I press F2, I find it impossible to screen, because the format of the saved picture is JPEG, but it never happened before.
Environment
Java:1.8.0_151 64bit
When I press F2, I find it impossible to screen, because the format of the saved picture is JPEG, but it never happened before.
[15:50:49] [Client thread/WARN]: Couldn't save auto screenshot java.io.IOException: Could not write image to the PNG file "C:\Users\User\AppData\Roaming\minecraft\saves\Survival1_13\icon.png": Corrupt JPEG at cgj.a(SourceFile:305) ~[17w45b.jar:?] at bxm.n(SourceFile:1047) [17w45b.jar:?] at bxm.a(SourceFile:957) [17w45b.jar:?] at bko.b(SourceFile:811) [17w45b.jar:?] at bko.a(SourceFile:370) [17w45b.jar:?] at net.minecraft.client.main.Main.main(SourceFile:134) [17w45b.jar:?]
Java
:1.8.0_151 64bitJava: 1.8.0_151 64bit
is duplicated by
[15:50:49] [Client thread/WARN]: Couldn't saveautoscreenshot java.io.IOException: Could not write image to the PNG file "C:\Users\User\AppData\Roaming\minecraft\saves\Survival1_13\icon.png": Corrupt JPEG at cgj.a(SourceFile:305) ~[17w45b.jar:?] at bxm.n(SourceFile:1047) [17w45b.jar:?] at bxm.a(SourceFile:957) [17w45b.jar:?] at bko.b(SourceFile:811) [17w45b.jar:?] at bko.a(SourceFile:370) [17w45b.jar:?] at net.minecraft.client.main.Main.main(SourceFile:134) [17w45b.jar:?][11:50:41] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file "F:\Hello minecraft ������\.minecraft\screenshots\2017-11-10_11.50.41.png": Corrupt JPEG at cgd.a(SourceFile:305) ~[17w45a.jar:?] at bkm.a(SourceFile:45) ~[17w45a.jar:?] at bkm.a(SourceFile:30) ~[17w45a.jar:?] at bkf.a(SourceFile:256) ~[17w45a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bks.a(SourceFile:282) [17w45a.jar:?] at bki.b(SourceFile:837) [17w45a.jar:?] at bki.a(SourceFile:370) [17w45a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:134) [17w45a.jar:?]
is duplicated by
Unable to save screenshotof PNG formatUnable to save screenshots if the path contains non-ASCII characters
is duplicated by
[11:50:41] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file"F:\Hello minecraft ������\.minecraft\screenshots\2017-11-10_11.50.41.png": Corrupt JPEG at cgd.a(SourceFile:305) ~[17w45a.jar:?] at bkm.a(SourceFile:45) ~[17w45a.jar:?] at bkm.a(SourceFile:30) ~[17w45a.jar:?] at bkf.a(SourceFile:256) ~[17w45a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bks.a(SourceFile:282) [17w45a.jar:?] at bki.b(SourceFile:837) [17w45a.jar:?] at bki.a(SourceFile:370) [17w45a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:134) [17w45a.jar:?]The bug
Taking a screenshot fails when the folder of your game profile contains non-ASCII characters.
18w06a[22:40:50] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file "###\screenshots\2018-02-11_22.40.50.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at bxc.a(SourceFile:45) ~[18w06a.jar:?] at bxc.a(SourceFile:30) ~[18w06a.jar:?] at bwu.a(SourceFile:256) ~[18w06a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bwx.b(SourceFile:803) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Additionally world icons cannot be saved either.
18w06a[22:45:42] [Client thread/WARN]: Couldn't save auto screenshot java.io.IOException: Could not write image to the PNG file "###\saves\New World\icon.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at cjr.n(SourceFile:1039) [18w06a.jar:?] at cjr.a(SourceFile:949) [18w06a.jar:?] at bwx.b(SourceFile:823) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]How to reproduce
- Create a folder whose name contains non-ASCII characters, for example the following
äö²³§ß- Launch Minecraft with this folder as game directory
- Try to take a screenshot
Unable to save screenshots and world icons if the path contains non-ASCII characters
is duplicated by
The bug
Taking a screenshot fails when the folder of your game profile contains non-ASCII characters.
18w06a[22:40:50] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file "###\screenshots\2018-02-11_22.40.50.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at bxc.a(SourceFile:45) ~[18w06a.jar:?] at bxc.a(SourceFile:30) ~[18w06a.jar:?] at bwu.a(SourceFile:256) ~[18w06a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bwx.b(SourceFile:803) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Additionally world icons cannot be saved either.
18w06a[22:45:42] [Client thread/WARN]: Couldn't save auto screenshot java.io.IOException: Could not write image to the PNG file "###\saves\New World\icon.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at cjr.n(SourceFile:1039) [18w06a.jar:?] at cjr.a(SourceFile:949) [18w06a.jar:?] at bwx.b(SourceFile:823) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]How to reproduce
- Create a folder whose name contains non-ASCII characters, for example the following
äö²³§ß- Launch Minecraft with this folder as game directory
- Try to take a screenshot
Code analysis
Code analysis by [Mod] Pokechu22 can be found in this comment.
Java: 1.8.0_151 64bit
relates to
is duplicated by
is duplicated by
The bug
Taking a screenshot fails when the folder of your game profile contains non-ASCII characters.
18w06a[22:40:50] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file "###\screenshots\2018-02-11_22.40.50.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at bxc.a(SourceFile:45) ~[18w06a.jar:?] at bxc.a(SourceFile:30) ~[18w06a.jar:?] at bwu.a(SourceFile:256) ~[18w06a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bwx.b(SourceFile:803) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Additionally world icons cannot be saved either.
18w06a[22:45:42] [Client thread/WARN]: Couldn't save auto screenshot java.io.IOException: Could not write image to the PNG file "###\saves\New World\icon.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at cjr.n(SourceFile:1039) [18w06a.jar:?] at cjr.a(SourceFile:949) [18w06a.jar:?] at bwx.b(SourceFile:823) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Besides the profile name also having non-ascii chars in the world name triggers that issue:
{code title=18w20b}java.io.IOException: Could not write image to the PNG file "D:\mc\mn\bugs\.minecraft\saves\����BUG\icon.png": Corrupt JPEG
at deq.a(SourceFile:306) ~[18w20b.jar:?]
at cvd.o(SourceFile:870) [18w20b.jar:?]
at cvd.a(SourceFile:783) [18w20b.jar:?]
at cht.c(SourceFile:820) [18w20b.jar:?]
at cht.a(SourceFile:381) [18w20b.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:144) [18w20b.jar:?]How to reproduce
- Create a folder whose name contains non-ASCII characters, for example the following
äö²³§ß- Launch Minecraft with this folder as game directory
- Try to take a screenshot
Code analysis
Code analysis by [Mod] Pokechu22 can be found in this comment.
The bug
Taking a screenshot fails when the folder of your game profile contains non-ASCII characters.
18w06a[22:40:50] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file "###\screenshots\2018-02-11_22.40.50.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at bxc.a(SourceFile:45) ~[18w06a.jar:?] at bxc.a(SourceFile:30) ~[18w06a.jar:?] at bwu.a(SourceFile:256) ~[18w06a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bwx.b(SourceFile:803) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Additionally world icons cannot be saved either.
18w06a[22:45:42] [Client thread/WARN]: Couldn't save auto screenshot java.io.IOException: Could not write image to the PNG file "###\saves\New World\icon.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at cjr.n(SourceFile:1039) [18w06a.jar:?] at cjr.a(SourceFile:949) [18w06a.jar:?] at bwx.b(SourceFile:823) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Besides the profile name also having non-ascii chars in the world name triggers that issue:
{code title=18w20b}java.io.IOException: Could not write image to the PNG file "D:\mc\mn\bugs\.minecraft\saves\����BUG\icon.png": Corrupt JPEG
at deq.a(SourceFile:306) ~[18w20b.jar:?]
at cvd.o(SourceFile:870) [18w20b.jar:?]
at cvd.a(SourceFile:783) [18w20b.jar:?]
at cht.c(SourceFile:820) [18w20b.jar:?]
at cht.a(SourceFile:381) [18w20b.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:144) [18w20b.jar:?]How to reproduce
- Create a folder whose name contains non-ASCII characters, for example the following
äö²³§ß- Launch Minecraft with this folder as game directory
- Try to take a screenshot
Code analysis
Code analysis by [Mod] Pokechu22 can be found in this comment.
The bug
Taking a screenshot fails when the folder of your game profile contains non-ASCII characters.
18w06a[22:40:50] [Client thread/WARN]: Couldn't save screenshot java.io.IOException: Could not write image to the PNG file "###\screenshots\2018-02-11_22.40.50.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at bxc.a(SourceFile:45) ~[18w06a.jar:?] at bxc.a(SourceFile:30) ~[18w06a.jar:?] at bwu.a(SourceFile:256) ~[18w06a.jar:?] at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) [lwjgl-glfw-3.1.2.jar:?] at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.1.2.jar:?] at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) [lwjgl-glfw-3.1.2.jar:?] at bwx.b(SourceFile:803) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Additionally world icons cannot be saved either.
18w06a[22:45:42] [Client thread/WARN]: Couldn't save auto screenshot java.io.IOException: Could not write image to the PNG file "###\saves\New World\icon.png": Corrupt JPEG at csp.a(SourceFile:306) ~[18w06a.jar:?] at cjr.n(SourceFile:1039) [18w06a.jar:?] at cjr.a(SourceFile:949) [18w06a.jar:?] at bwx.b(SourceFile:823) [18w06a.jar:?] at bwx.a(SourceFile:383) [18w06a.jar:?] at net.minecraft.client.main.Main.main(SourceFile:141) [18w06a.jar:?]Besides the profile name also having non-ascii chars in the world name triggers that issue:
18w20bjava.io.IOException: Could not write image to the PNG file "D:\mc\mn\bugs\.minecraft\saves\����BUG\icon.png": Corrupt JPEG at deq.a(SourceFile:306) ~[18w20b.jar:?] at cvd.o(SourceFile:870) [18w20b.jar:?] at cvd.a(SourceFile:783) [18w20b.jar:?] at cht.c(SourceFile:820) [18w20b.jar:?] at cht.a(SourceFile:381) [18w20b.jar:?] at net.minecraft.client.main.Main.main(SourceFile:144) [18w20b.jar:?]How to reproduce
- Create a folder whose name contains non-ASCII characters, for example the following
äö²³§ß- Launch Minecraft with this folder as game directory
- Try to take a screenshot
Code analysis
Code analysis by [Mod] Pokechu22 can be found in this comment.
is duplicated by
is duplicated by
relates to
Thank you for your report!
However, this issue is a Duplicate of MC-121714.
It has been linked to this report. If you have additional information, please add it to that report.
Please search before reporting, as it's likely that one exists already.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki
Possibly caused by MC-121714 – does the path to your .minecraft folder have any non-English characters in it?
I have the same problem and I think this is not a duplicate of MC-121714, because I CAN take screenshots with F2 every time, but CANNOT create "succesfully" world icons in 1.12.2 and my world's path supposedly has only ASCII characters (only has a to z, A to Z, 0 to 9, the period of ".minecraft" and the colon of "C:"), but I can't/[don't know how to] confirm the encoding of that characters.
On some worlds worked, but in other it is never created, at world creation, or (in other worlds) can't be re-taked.
I have made an experiment creating an icon.png file of 64x64 pixels with an image editor, then I inserted it in the world folder, started MC and it appeared as expected in the world selection menu. Then I clicked Reset Icon and the only thing that hapen is that the file gets removed and the world icon is never created when entering the world and wait more than "no matter the number of" hours, even repeating multiple times the said process, with another copies of the icon, in the same world.
In some ocasions (maybe with worlds created some versions before) it might work after ~10 min, but that is very rare.
Cannot reproduce either.
Did the path to your minecraft folder change or something like that? Are you possibly encountering MC-121714?
Due to MC-133136 it isn't possible to directly check this in current releases, but the same code is present still.
The STBIWriteCallback instance that is created to save screenshots is never free'd after use, causing a very small memory leak. (This callback exists to fix MC-121714). Simply adding a free call or putting it into the existing try-with-resources block would solve this.
In 1.13-pre3, the leak detector (-Dorg.lwjgl.util.Debug=true -Dorg.lwjgl.util.DebugAllocator=true) reports:
[LWJGL] 16 bytes leaked, thread 1 (Client thread), address: 0x2110000 at org.lwjgl.stb.STBIWriteCallback.<init>(STBIWriteCallback.java:37) at dfw$a.<init>(SourceFile:325) at dfw$a.<init>(SourceFile:321) at dfw.a(SourceFile:349) at dfw.a(SourceFile:318) at cjh.a(SourceFile:45) at cjh.a(SourceFile:30) at ciz.a(SourceFile:276) at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:23) at org.lwjgl.system.JNI.invokeV(Native Method) at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:2520) at cjm.a(SourceFile:296) at cjc.c(SourceFile:839) at cjc.a(SourceFile:378) at net.minecraft.client.main.Main.main(SourceFile:143)

This is weird and should not happen. Can you please attach the game's log files (located in .minecraft/logs)?
I found that as soon as I upgraded to this version, there would be problems
Looking at
, apparently this has todo with non-ascii characters in the path name.
MC-122415, and the screenshots provided by 陈执一 in this ticket hereI'm not so sure if
MC-121830is really a duplicate and is possibly caused by something different.Not fixed. Could reproduce it in 18w06a.
It can also be reproduced in 18w08a and 18w08b.
log:
[12:27:28] [Client thread/WARN]: Couldn't save auto screenshot
java.io.IOException: Could not write image to the PNG file "D:\1.13 snapshot\.minecraft\saves\新的世界\icon.png": Corrupt JPEG
at cuh.a(SourceFile:306) ~[18w08b.jar:?]
at cle.n(SourceFile:1049) [18w08b.jar:?]
at cle.a(SourceFile:962) [18w08b.jar:?]
at bya.b(SourceFile:820) [18w08b.jar:?]
at bya.a(SourceFile:381) [18w08b.jar:?]
at net.minecraft.client.main.Main.main(SourceFile:141)
I meet the same problem. I hope it can be resolved quickly. Using 搜狗输入法 to take a screenshot is not convenient.
Can reproduce in 18w08b.
Analysis:
This is an issue in the stb image library, which is used (via the LWJGL binding) to save screenshots. There is an open pull request to fix this; the fix would also need to be applied to the LWJGL version of the library.
I've tried that myself, and while getting LWJGL to build right was hard, that PR (plus some changes to define UNICODE, because I don't have everything set up right) did allow it to build correctly and fix this issue.
However, there is an issue on the MC end, which is the reason for the "Corrupt JPEG" message despite the game loading a PNG. Using 18w10b obf, in cvf (NativeImage?) on line 305:
stb_image_write does not do anything with (and in fact does not know about) general stb_image errors; the message returned from STBImage.stbi_failure_reason is unrelated to the reason why the call to stbi_write_png failed. So the "Corrupt JPEG" message doesn't apply, and the call to stbi_failure_reason should probably be removed.
Perhaps it would also make sense to use stbi_write_png_to_func, and manually handle writing to disk, as that should bypass this unicode issue.
I'm not sure where the "Corrupt JPEG" part comes from, but as a quick note I did build lwjgl_stb.dll with the "non-user-friendly" message mode, and I got "no SOI" instead which indicates an error in stbi__decode_jpeg_header. This is probably from some earlier code, but I don't know which.
18w21a affected
18w22c affected