Image.FromPixels giving strange results


#1

I’m not sure what I’m doing wrong here. I’ve got an image file I made 200x200 px and loaded it in, then attempted to create a list of the pixel data with Image.Pixels. As a verification that my results were correct I hooked it up to Image.FromPixels to recreate the image file from the list of pixels. Everything appears to be correct except the blue channel and alpha channel are switched. Where blue should be reading 1 and alpha as fully opaque (255), its the other way around. Anyone have thoughts? See image below:

Capture


#2

This looks wrong. Post a bug on GitHub: https://github.com/DynamoDS/Dynamo/issues


#3

Ryan,

Do you still see the same problem in the data if you remove Watch Image from the file? We are seeing a couple other issues with Watch Image and are working on them.

Thanks

Z


#4

Not to beat a dead horse, but I learned it is good practice to reply in an existing topic if the subject already exists.

Working with this node, I found two things:

  1. when searching the list for a color, I can’t compare it to the output of a Color.ByArgb node.I have to parse the R, G and B values through an == node individually.
  2. most importantly, am I the only one who thinks that reading an image file takes a very long time? I’ve tried both compressed (.png) and uncompressed (.bmp) files, and reading the original file at 10% of the original width and height (close to 1080p screen resolution) takes almost a minute. Leading me to believe that the image at full scale takes an hour and a half. (Which is why I set it to read at scale 1:2, which still takes more than 20 minutes if my assumption is right)

So what is this node for anyway? In my experiment I blended a watermark in and a logo, but this takes me less than 20 minutes in a free program such as paint.net. It is not suitable IMO as a batch image processor to perform a standard operation on a hundred exported views, unless you’re OK with dedicating your computer to this every night for a week.


#5

I would guess the issue is actually creating the list of pixels and adding these to a list, and moving them around /manipulating them, displaying them in the list etc. 10% of a 1080p texture is 200,000 pixels, thats 200,000 color objects, 200,000 entries in a list, and every time you use another node to move that data around you are copying 200,000 colors objects as Dynamo is usually immutable.