Non compressing png writer is ok.

This commit is contained in:
James Grogan 2022-11-25 09:43:14 +00:00
parent 33369b1775
commit e4f9393ee7
18 changed files with 196 additions and 23 deletions

View file

@ -13,9 +13,17 @@ int main()
const auto path = "/home/jmsgrogan/code/MediaTool-build/bin/test.png";
File file(path);
std::cout << file.dumpBinary();
PngReader reader;
reader.setPath(path);
auto image = reader.read();
for(unsigned idx=0; idx<image->getWidth()*image->getBytesPerRow(); idx++)
{
std::cout << "Image val: " << idx << " | " << static_cast<int>(image->getDataRef()[idx]) << std::endl;
}
return 0;
}

View file

@ -9,8 +9,8 @@
int main()
{
unsigned width = 10;
unsigned height = 10;
unsigned width = 20;
unsigned height = 20;
unsigned numChannels = 1;
auto image = Image<unsigned char>::Create(width, height);
image->setNumChannels(numChannels);
@ -19,7 +19,8 @@ int main()
std::vector<unsigned char> data(width*height, 0);
for (unsigned idx=0; idx<width*height; idx++)
{
data[idx] = 10;
unsigned char val = 255 * idx /(width*height);
data[idx] = val;
}
image->setData(data);