UnityNativeGallery icon indicating copy to clipboard operation
UnityNativeGallery copied to clipboard

An error saying missing IHDR occurs.

Open ParkEunSeong opened this issue 1 year ago • 7 comments

Description of the bug

This nativegallery occurs in native gallery. Please tell me how to solve it.

Reproduction steps

If possible, providing reproduction steps would be very helpful while pinpointing the issue. You can also post screenshots if you think they would be helpful.

Platform specs

Please provide the following info if this is a Unity 3D repository.

  • Unity version: 2020.3.48f1
  • Platform: iOS
  • Device: IPAD Mini 5
  • How did you download the plugin: Asset Store

Additional info

Please check Logcat (Android) or Xcode console (iOS) for any meaningful error messages and include them here.

libpng error: [00][00][00][00]: missing IHDR Couldn't load image at path: /var/mobile/Containers/Data/Application/D06113B1-A048-46B9-A0C0-825C3AFFA123/Library/Caches/tmpImg NativeGallery:LoadImageAtPath(String, Int32, Boolean, Boolean, Boolean)

ParkEunSeong avatar Sep 18 '23 06:09 ParkEunSeong

In this thread, the plugin seemed to not have this issue in a new Unity project. Is it the same for you?

yasirkula avatar Sep 18 '23 07:09 yasirkula

In this thread, the plugin seemed to not have this issue in a new Unity project. Is it the same for you?

That's right. It works normally in a newly created project. I overwrote the plugin that works normally, but the same thing happens. If you look at the log, the difference is that even the file name is written in the log when it works normally, but in projects that don't work, the folder called tmpImg ends. Do you also know what missing IHDR means?

ParkEunSeong avatar Sep 18 '23 08:09 ParkEunSeong

The error occurs at this line, right?

https://github.com/yasirkula/UnityNativeGallery/blob/c777ed2b916eed860bbab7dc9baf2bc422ec42ce/Plugins/NativeGallery/NativeGallery.cs#L795

And does replacing this filename to tmpImg.png make any difference:

https://github.com/yasirkula/UnityNativeGallery/blob/c777ed2b916eed860bbab7dc9baf2bc422ec42ce/Plugins/NativeGallery/NativeGallery.cs#L145

Lastly, could you put numerous NSLog functions inside this function and see if both your current project and the empty project follow exactly the same codepath (enter the same if conditions, return the same filepath, etc.) while picking the same png image?

https://github.com/yasirkula/UnityNativeGallery/blob/c777ed2b916eed860bbab7dc9baf2bc422ec42ce/Plugins/NativeGallery/iOS/NativeGallery.mm#L703

yasirkula avatar Sep 18 '23 09:09 yasirkula

libpng error: [00][00][00][00]: missing IHDR Couldn't load image at path: /var/mobile/Containers/Data/Application/A6A4723A-5627-48E6-B2A0-BC42DDB12123/Library/Caches/pickedMedia1.png

Log with maxsize set to -1. While there are images that can be imported, there are images that cannot be imported.

ParkEunSeong avatar Sep 19 '23 02:09 ParkEunSeong

May I ask what you did differently in your latest post and the original post? Can you follow my guide here: https://github.com/yasirkula/UnityNativeGallery/issues/297#issuecomment-1723080366

yasirkula avatar Sep 19 '23 16:09 yasirkula

May I ask what you did differently in your latest post and the original post? Can you follow my guide here: #297 (comment)

hello. We found out the cause. Images captured by iOS or saved from a camera are in .HEIC format. After converting the .HEIC format photo to .JPG, I loaded the image normally using Native Gallery Load. Is it possible to update the library to convert .heic format to .jpg or .png?

ParkEunSeong avatar Sep 22 '23 08:09 ParkEunSeong

But the same HEIC image can be loaded in an empty project correctly, according to your reply. I can't find the difference between the empty project and the actual project unless you help me.

yasirkula avatar Sep 22 '23 11:09 yasirkula