openframeworks / openframeworks/openFrameworks
ofSaveImage & ofFloatImage outputs noise
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
Hi
when I use the save method of ofFloatImage with a buffer I only get noise.
Maybe I am doing something wrong.
This one outputs white noise:
ofFloatImage pix_img_out;
ofBuffer imgOut;
pix_img_out.save( imgOut, OF_IMAGE_FORMAT_PNG, OF_IMAGE_QUALITY_BEST );
ofFile pixFile = ofFile(args.getFilename(), ofFile::ReadWrite);
pixFile.writeFromBuffer(imgOut);
actually the problem might be in the ofSaveImage function. The following example does not work:
ofFloatImage pix_img_out;
ofBuffer imageBuffer;
ofSaveImage(pix_img_out.getPixels(), imageBuffer); // <<<< here
ofFile pixFile = ofFile(args.getFilename(), ofFile::ReadWrite);
pixFile.writeFromBuffer(imageBuffer);
I had to get the pixels and then save the pixels to a buffer. This one does work:
ofFloatImage pix_img_out;
ofPixels pixels = pix_img_out.getPixels(); // <<< pixels declared and I assume copied
ofBuffer imageBuffer;
ofSaveImage(pixels, imageBuffer); <<< works
ofFile pixFile = ofFile(args.getFilename(), ofFile::ReadWrite);
pixFile.writeFromBuffer(imageBuffer);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two examples using ofFloatImage::save and ofSaveImage, comparing the buffer produced from ofFloatImage pixels with the buffer produced from copied ofPixels. Trace the relevant overloads and verify that the resulting file is a valid, correctly rendered PNG rather than noise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100