Open leafstorm opened 10 years ago
I also see this problem with gifs. I am running JES 5.0 on a Mac running OSX 10.10.5 and Java 1.7.0_55.
I think I know what the problem is. We cache pixels, so that every pixel change doesn't change the underlying picture, since that's slow. Sounds like getPixel is sometimes accessing the underlying picture when the cache has a changed pixel. Try exploring the picture -- I'll bet that the pixel will be changed in the explorer. Exploring the picture will also push the updates to the underlying picture.
We'll put this on the to-fix queue. Thanks!
Thanks for the quick response! Explore shows the wrong colors. That is how we discovered it. A student wrote a very simple function to keep just the red values and it was clear looking at it in explore that it was not doing that. After much scrutinizing for some mysterious bug, re-starting JES in case there was old code that had put things in a wrong state, etc., we tried it on a different computer and happened to use a jpeg instead and it worked. I then tried it on a gif on the 2nd computer and it did not work.
Here is the code and photo.
def justRed ( picture ) :
# Loop over all pixels
for pixel in getPixels ( picture ) :
# reduce blue & green to minimum value
setBlue (pixel, 0)
setGreen (pixel, 0)
def testJustRed ( ) :
# Loop over all pixels
myFile = '/Users/blerner/Pictures/Backgrounds/SnickersAtTheBeach.gif'
myPict = makePicture (myFile)
explore (myPict)
justRed (myPict)
explore (myPict)
Interesting! I wonder if it's a GIF vs. JPEG thing. Will look into it.
From christop...@gmail.com on August 16, 2012 15:01:39
What steps will reproduce the problem? 1. Load a gif image
Original issue: http://code.google.com/p/mediacomp-jes/issues/detail?id=57