Colors are of in Image in jsui

Stefan Axn's icon

Hello,
i am using a image in which i am loading in the jsui object with the following code:

var myfile = "images\\charset_fractures_04.png"; 
var img = new Image(myfile);
...
sketch.copypixels( img  , 0, 0, 0, 0,  img.size[0],  img.size[1]);

unfortunately the colors are slightly of no matter which file format i choose. i tried png, tif and jpg. if i load the image with an image object the color are right. can someone tell me what i'm doing wrong?


Rob Ramirez's icon

please send me the image file and your test patch

Stefan Axn's icon

I managed to find an solution on my own. It seems like the red and the green channel are switched.

shaun's icon

I'm having the same issue. Attached a patched showing the issue.

Max Patch
Copy patch and select New From Clipboard in Max.

editor.js
application/x-javascript 0.53 KB
jsui file

Rob Ramirez's icon

I can't reproduce. OS? Max version?

shaun's icon

hey,

max 8.05, windows 10. Will try it on another pc myself later.

Rob Ramirez's icon

thanks for following up, I see the problem on windows and will work on a fix for the next update.

shaun's icon

Thanks Rob,

could I ask if there's a way to use sketch.glbindtexture() with a named jit.gl.texture rather than an image object.
Or have a function like 'fromnamedmatrix()' but for textures for the image object like 'fromnamedtexture()'.

I would like to play a video in jsui but the only way I can figure out how to do it is a jit.movie with a named matrix which is bad for any hd video.

Cheers

siteswapjuggler's icon

Hello boys,

I'm getting the exact same problem here.
Max 8.1.11, Windows 10

@Rob Ramirez did you manage to fix it at one point ?

Sincerely
Sylvain

siteswapjuggler's icon

Actually it seems a little bit different, it's more than R and G swap.

JSUI (left) not good / picture (right) good

pac_ui.zip
application/x-zip-compressed 27.96 KB
test_files

siteswapjuggler's icon

Any update on this one ? I need to validate finish this app for my cliproject and still no solution for good color interpretation in jsui on Windows. Any help will be welcome.

siteswapjuggler's icon

I tested on different version of Max, the problem doesn't appear on MacOs and on Win32 version. Seems like a bug specific to 64 bit Windows version. If I should wonder I'd look for an implicit type information that goes from 32 to 64 bit causing the offset that we actually experienced.