Skip to content
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

Images Fail To Upload with TestClient #96

Open
cxtal opened this issue Aug 28, 2024 · 4 comments
Open

Images Fail To Upload with TestClient #96

cxtal opened this issue Aug 28, 2024 · 4 comments

Comments

@cxtal
Copy link
Contributor

cxtal commented Aug 28, 2024

Using TestClient and trying to upload an image with uploadimage results in a NullReferenceException error:

System.NullReferenceException: Object reference not set to an instance of an object.
   at CoreJ2K.Util.ImageFactory.New(Int32 width, Int32 height, Byte[] bytes)
   at CoreJ2K.Util.PortableImage.As[T]()
   at OpenMetaverse.TestClient.UploadImageCommand.LoadImage(String fileName) in
C:\Users\danny\Desktop\libremetaverse\Programs\examples\TestClient\Commands\Inventory\UploadImageCommand.cs:line 109 SL Image Upload

Also, in the last part of ExportBitmap in ManagedImage.cs if you go the other way around and try to convert to a ManagedImage first and then use ExportBitmap, the following code in ManagedImage.cs also throws a NullReferenceException:


            var img = SKImage.FromEncodedData(raw);
            return SKBitmap.FromImage(img);

with img turning out to be null with SKImage.FromEncodedData not managing to convert the image? Either way it seems that there is no way to upload an image.

@cinderblocks
Copy link
Owner

I'm including SkiaSharp native assets in TestClient on head. That should hopefully resolve your issue. What format is the image you are intending to upload?

@cxtal
Copy link
Contributor Author

cxtal commented Aug 30, 2024

As I understand it there are two formats that pertain to JPEG2000, one ending in JP2 which is a JPEG2000 Profile 1 and a J2C that is a JPEG2000 codestream. Neither seem to work. Including the SkiaSharp native assets might not be enough. There also seems to be another upstream issue where after the byte array is provided, the CreateInventoryItemFromAsset fails with No Error and InvalidAsset when looking at the OSD response. All parameters passed to CreateInventoryItemFromAsset seem correct though.

Interestingly, image downloads work without issue (!) which is frustrating because you'd think they'd just fail together if it were a library issue!

@cinderblocks
Copy link
Owner

Well, if it's a library issue, I'll get it figured out anyways as CoreJ2K is also my library. SkiaSharp has some unfortunate limitations with file formats, but it seems to be the de facto cross-platform imaging library these days.

@cxtal
Copy link
Contributor Author

cxtal commented Sep 13, 2024

Thank you for your efforts: the OpenJPEG issue is a long-standing problem that nobody wanted to touch with a 10ft pole. I remember there were so many issues even within the JPEG2000 with either .jp2 or .j2k not being recognized. IIRC JP2 was JPEG2000 version 2 or something like that and J2K is JPEG2000 codestream and only one of those was a valid upload with OpenMetaverse but the other one was not. Such a nightmare and for such a small issue. It's not like JPEG2000 is not clearly defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants