-
Notifications
You must be signed in to change notification settings - Fork 38
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
Get/set individual pixels in image #16
Comments
Yes I think that would be fine. Though it might be worth doing some benchmarking - individual pixel setting needs to be pretty fast in order to be useful in many cases so we don't want to encourage people to use an approach that adds unnecessary overheads. |
Probably an API function is OK as long as it gets inlined |
Great! Regarding benchmarking: I am using it for this project (see screenshot) and the lines appear instantly on the image; so it's certainly fast enough for my purposes. I'm sure it won't be as fast as Java arrays, but you still have to I'll try to put something together tomorrow when I have a minute. |
Your project looks cool! The array based stuff tends to have a slight advantage if you are doing something very customised and need to get / set a large number of times on the same data (implementing blurs, cellular automata, real-time animation, stuff like that...). You probably won't notice the difference if you are just setting some of the the pixels once :-) so yes, I agree a nice interface to get / set pixels would be good for general purpose use. |
Hi Mike, I'm playing with
imagez
for a small project.Right away I wanted to be able to get or set individual pixels in an image. I first went down the hard path of pulling out pixels from the image into a Java array,
aset
ing them, and putting them back usingset-pixels
. Then I discovered(.setRGB img x y color)
which works quite well, though it requires digging into the details ofBufferedImage
. Would you be open to a PR that wrapped.getRGB
and.setRGB
into the API you're providing with this library?The text was updated successfully, but these errors were encountered: