Feedback Unable to re-Import edited sprite image (.png file)

Discussion in 'GameMaker Studio 2 Community Tech Support' started by SnortySnoopy, Jul 10, 2019.

  1. SnortySnoopy

    SnortySnoopy Member

    Joined:
    Apr 25, 2018
    Posts:
    213
    Been getting this issue;

    My Output Window Message;
    Code:
    String not found: YoYoImage_UnknownFileFormat
    whenever I decide to replace sprite image on IDE v.2.2.3.433 Runtime v.2.2.3.341. I don't think I've ever encounter this issue before this current version.

    This happens whenever the original image file (.PNG) which was already imported to the project folder is then edited using the same software used to initially create/draw/make it - without changing the original file name or any of its original settings, then when that file is re-imported the error occurs. Doesn't matter if I have removed the original file from "SPRITES" resource, or used the broom tool, before reimporting the file to its original location. This issue doesn't occur whenever I remove the images from resources, and reimport the same file back (unedited files).

    My UI.log at the point when I try re-importing the edited file;
    Code:
    [11:46:17:199(4adb)] ResumeThread: Suspended = 0 for watcher 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored'
    [11:46:21:838(4adb)] Attempting OpenFileDialog on main thread: True
    [11:46:27:142(4adb)] Exception in YoYoStudio.Plugins.CorePlugins.SpriteEditor.SpriteEditorModule+<>c__DisplayClass80_0,Void <ImportImageFiles>b__1(eResult) :    Hjg.Pngcs.PngjBadCrcException: crc invalid for chunk chunkid=iCCP len=389 calc=-1959770584 read=-1305000304
       at Hjg.Pngcs.Chunks.ChunkRaw.ReadChunkData(Stream stream, Boolean checkCrc)
       at Hjg.Pngcs.PngReader.ReadChunk(Byte[] chunkid, Int32 clen, Boolean skipforced)
       at Hjg.Pngcs.PngReader.ReadFirstChunks()
       at Hjg.Pngcs.PngReader.GetChunksList()
       at YoYoStudio.Core.Utils.YoYoImage.ReadPNG(Stream _baseStream)
       at YoYoStudio.Core.Utils.YoYoImage.FromStream(Stream _baseStream)
       at YoYoStudio.Core.Utils.YoYoImage.<>c__DisplayClass29_0.<FromFilename>b__0(Object _r, Object _ud)
       at YoYoStudio.FileAPI.FileRequest.Complete(Object _result, Object _userData)
       at YoYoStudio.FileAPI.FileSystem_Local.<>c__DisplayClass23_1.<GetStream>b__2()
       at YoYoStudio.FileAPI.FileRequest.ResultOperation()
       at YoYoStudio.FileAPI.FileRequest.wait()
       at YoYoStudio.Core.Utils.YoYoImage.FromFilename(String _filename)
       at YoYoStudio.Plugins.CorePlugins.SpriteEditor.Resize.SpriteResizeHelper.AddImagesWithResizeDialog(GMSprite_Controller _sprite, SpriteResizeDialog _dialog, IList`1 _filenames, Boolean _import, Func`1 _showDialog, Action _onComplete)
       at YoYoStudio.Plugins.CorePlugins.SpriteEditor.SpriteEditorModule.AddImagesWithResizeDialog(IList`1 _filenames, Boolean _import)
       at YoYoStudio.Plugins.CorePlugins.SpriteEditor.SpriteEditorModule.<>c__DisplayClass80_0.<ImportImageFiles>b__1(eResult _result)
       at WeakDelegate(Object , Object[] )
       at YoYoStudio.Core.Utils.WeakDelegate`1.Invoke(Object[] _args)
    [11:46:28:577(4adb)] Suspend: Suspended = 1 for watcher 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored'
    To resolve this issue, I've to create a new blank file in the drawing/image software, import the effected edited file, and then re-save it as is (same name, same extension, same format, same settings, etc. as the original). Of cause no problem if decide to rename it differently. Only then will the IDE process the import successfully back to its designated location. This issue occurs not just with images made and then edited using GIMP, but also those made using Krita. Don't know about other software since I only use these 2. Note: I always edit files using the same tool used to create it, never mix/cross edit since each images are labeled. So no it's not caused by software mixed up.

    This is the UI.log result for imports after file is re-saved with the workaround method mentioned above.
    Code:
    [11:59:20:297(4adb)] ResumeThread: Suspended = 0 for watcher 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored'
    [11:59:22:900(4adb)] Attempting OpenFileDialog on main thread: True
    [11:59:26:210(4adb)] IDE: SaveSelectedResources()
    [11:59:26:211(4adb)] Setting FolderWatcher 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored' to False
    [11:59:26:212(4adb)] Saving project resources to: D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored\censored.yyp
    [11:59:26:212(4adb)] Saving project at 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored\censored.yyp'
    [11:59:26:214(4adb)] Saving 5 resources
    [11:59:26:431(4adb)] Save project took 00:00:00.2181504
    [11:59:26:431(4adb)] Setting FolderWatcher 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored' to True
    [11:59:30:848(4adb)] Suspend: Suspended = 1 for watcher 'D:\PROJECT FOLDER GameMaker Studio 2\Project Folder\Production\censored\censored'
    Well I just find it annoying (that's all) as I've to perform extra steps just to get the image files reimported whenever I need to make adjustments/edits to it, which often time isn't convenient to do using the IDE's image editor due to its limited tools when compare to the regular image editing software.

    Anyway, should there is/are anyone facing similar issue; try doing what I did to workaround the problem. :)
     
  2. Azuflux

    Azuflux Member

    Joined:
    Jul 21, 2019
    Posts:
    1
    I'm having the same issue. I haven't figured out how to fix it, but it has to be some kind of bug. Hopefully this gets more attention and it gets fixed. In the meantime thanks for describing your workaround, I have been doing what you described and it works for me.
     
    SnortySnoopy likes this.
  3. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,512
    I've been organising tilesheets in the last few days which has involved cutting / pasting tiles from various images into a single tilesheet that will be used in GMS2.
    The tilesheet image was imported into GMS2 with a few tiles on it, and then I would gradually continue to add tiles to the source image using Aseprite or PyxelEdit, export the new sheet, then open the sprite in GMS2 and click the import button to load the newly saved tilesheet.

    This would load the new tilesheet sprite and also update the tileset that used the sprite within the IDE at the same time.
    (ie. if I changed a tile that was being used on a tile layer it would auto-update in the room editor to show this as soon as I imported the new sprite image).

    This has worked fine over multiple editing sessions where the image has been closed and re-opened and I've had no issues at all like the ones you have described.

    Are you editing the actual file GMS2 creates when it imports an image, or a seperate source file that you then re-import into the sprite in GMS2 using the Import button in the Sprite Editor?
    You have redacted your path in your output - does it contain any non alphanumeric characters that could be causing problems?
    Just as a test, have you tried saving your project using File > Save As and choosing a name using just a-z / A-Z characters and without any spaces?
    Are you now using the latest version of GMS2?

    It could also be an issue specific to GIMP and Krita although that seems unlikely, but it sounds like a real chore to have to keep creating empty files to simply update a sprite, hope you can find the cause.
     
  4. SnortySnoopy

    SnortySnoopy Member

    Joined:
    Apr 25, 2018
    Posts:
    213
    My images aren't in the form of tileset/sprite sheet. And regardless how it's named, the issue persist. Including if I choose Save As instead of Export in KRITA/GIMP post editing the file (separate source/original source - not the one imported into the project folder). My habit is to delete the existing images (press X on the images in the sprite under resources), then press import or drag the images onto the sprite window. So no, I never edit the imported image stored in the project folder, always the original file. The edited .PNG load fine using image viewer or any that can handle .PNG so I'm quite certain it's not corrupted that caused the issue when importing an edited .png to GMS2. But yes, I'm using the latest current IDE v.2.2.3.436 Runtime v.2.2.3.344 and it can be quite a chore to do especially when each sprite is made up of several images, but it's better than getting agitated over something I can't fix. I'm waiting for the next IDE/Runtime update to test if this issue still exist before considering to submit a bug report, because like I said previously, I don't recall experiencing this problem on previous IDE/Runtime with .PNG file created & edited using the exact same Krita/Gimp version.
     
    Last edited: Jul 22, 2019
  5. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,512
    If you can reproduce the issue reliably in a new project and list the steps required to make it happen then I'd a file a bug report now rather than wait as it might not be fixed in an update if it is a bug.

    Attach the project to the ticket and attach the sprites you have problems re-importing too so they have everything they need to reproduce it.

    Use Help > Report a Bug in the IDE.
     
  6. SnortySnoopy

    SnortySnoopy Member

    Joined:
    Apr 25, 2018
    Posts:
    213
    It's not difficult to replicate. Maybe you too will experience it if you try doing what I did. Try doing these steps;

    1. Create a random image in GIMP, choose EXPORT AS, and name it as you please (.png), close the saved image file.
    2. Create new sprite in GMS2 resource tree - import the image from wherever its location in your drive.
    3. Go back to GIMP and choose OPEN, locate that image file and edit it as you please, choose EXPORT, keep the name the same or change it, doesn't matter.
    4. Go back to GMS2, press X on that existing sprite.
    5. Press import like in step 2.
    6. You'll notice the error message in your output window and in the ui.log.

    7. Next, go back to GIMP, choose to create a new file, for consistency, make sure to keep the size the same
    8. You may either drag and drop that edited file or choose IMPORT
    9. Now export it and keep the name the same or change it, your choice
    10. Go back to GMS2, and import that image again, should work this time.

    Note: I'm using the latest stable GIMP.

    I'm going to prepare a full ui.log to attach without redacting the parts I censored, and the test project. And link this topic. It's been like this since IDE v.2.2.3.433, so I guess you're right, it probably won't get fixed or investigated unless I make a formal report. Anyway since this topic was revived, I decided to do a quick check in the test project folder. I notice the sprite I deleted/removed in step 4. seems to still exist in its folder despite under resources the window shows it blank. So maybe that's the reason it shows the error message, it's not being removed or overwritten despite I've pressed X?
     
  7. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,512
    I don't have GIMP so can't test right now but will when I get some time.

    What do you mean in Step 4 "Press X on the existing sprite"?
    When I'm editing sprites I just edit them, export them, then open the sprite in GMS2 and click "Import" and the old sprite gets overwritten.

    I also don't have to close the sprite being edited in the external editor, or does GIMP lock the files in some way which means you have to before you can import it?
     
  8. SnortySnoopy

    SnortySnoopy Member

    Joined:
    Apr 25, 2018
    Posts:
    213
    I meant the one I circled in red below;
    [​IMG]
    When I choose to export from GIMP, it's not saved to the project file. It's saved to the original file location. I don't point GIMP to overwrite the one in the project folder. Which is what I always been doing for a long time.

    I don't always edit images while I work on GMS2, sometimes the decision to edit an image file happened hours or days later. As such the file & GIMP/KRITA would already be closed.

    Edit:

    I've filed a report. :)
     
    Last edited: Jul 22, 2019
  9. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,512
    I've never clicked that x to remove any existing sprites before reimporting the new one, I just hit Import and import it over the existing one, same with Spine sprites which are way more complex and it works fine.

    Does your sprite have multiple frames?
     
  10. SnortySnoopy

    SnortySnoopy Member

    Joined:
    Apr 25, 2018
    Posts:
    213
    Depend, it might be 1 frame to multiple frames. But speaking about the test project to replicate the issue - which I've sent along with the bug report, I only used 1 frame. But it's been a habit of mine to press on the X button to either delete a frame or several frames, instead of going ahead to overwrite through the method you described.

    I just tried importing the edited image to replace the original image already present in the sprite window (the method you described), unfortunately the same error still shows up, and the sprite image wasn't replaced with the edited version. Needless to say, the content of that sprite's folder in the project folder didn't change nor was it deleted.

    At least with the workaround I've been doing , the project I'm working on isn't significantly effected. I just have to keep reminding myself to do the extra steps.
     
  11. Dan

    Dan YoYo Games Staff YYG Staff

    Joined:
    Apr 15, 2016
    Posts:
    339
    Yes, as rIKmAN says two above this message, there is no need to delete the current sprite and re-import it again. Don't do steps 4 and 5 and you should be fine.

    The issue here is you're confusing the file watcher, which is already going to look for you modifying that file outside GMS2. It's noticing the change and processing it, but then while it's working you're deleting the file and creating a new copy, but you're presumably clicking Save/Reload on the dialogue to get rid of it (as you think this is false info) and at that point you're breaking the save.

    Also note that the file watcher is not "an error"; it's an extremely important dialog that tells you what's going on with your files (it likely told you what was happening here) - and you are actually doing the exact workflow that dialog intends to help with, so I would not recommend turning it off ;)

    If you're editing the file outside GMS2, make sure you click Reload (bring in the external changes), not Save (ignore the external changes and re-save the project as it is in the IDE just now). Then your sprites should update fine. If they definitely don't, look into the file watcher settings and slow the process down a bit - it might be set too frequently for the external editor to release the lock on the file properly after editing it before GMS2 notices the change.
     
    rIKmAN likes this.
  12. SnortySnoopy

    SnortySnoopy Member

    Joined:
    Apr 25, 2018
    Posts:
    213
    I see. Alright, in that case I'll give it another try, and do as suggested if the issue persisted. Thank you.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice