stbrumme / toojpeg Goto Github PK
View Code? Open in Web Editor NEWA JPEG encoder in a single C++ file
Home Page: https://create.stephan-brumme.com/toojpeg/
License: zlib License
A JPEG encoder in a single C++ file
Home Page: https://create.stephan-brumme.com/toojpeg/
License: zlib License
How to do it if I want to write it in class variable? There is conflict with class member and WRITE_ONE_BYTE.
It would be nice to add a CMakeLists to the library in order to simplify the use of this lib with bigger projects.
Hello,
Please I need to use your repo and use lena.PNG as input image, so I read the image in this way, but this not correct how can read the image in correct way?
ifstream im;
im.open("lena.PNG",std::ios_base::binary);
if (im.is_open())
{
cout<< "function success\n";
}
else
{
cout<< "unable to open file";
}
//get length of file:
im.seekg(0, im.end);
int n = im.tellg();
im.seekg (0, im.beg);
//allocate memory:
///char* image = new char[n];
const auto width = 512;
const auto height = 512;
// RGB: one byte each for red, green, blue
const auto bytesPerPixel = 3;
// allocate memory
auto image = new char[width * height * bytesPerPixel];
//read data as a block:
im.read( (image), n);
why not use some thing like
struct color_rgb {
uint8_t r, g, b;
};
It would ease effort, as algorithms like std::fill
and std::generate
can be used.
When i tried to compile, this message error message showed up in toojped.h (i already tried to use C++11, but it does't work)
Do you have any plans to add stride support for the input buffer?
I found your library searching for in memory compression/decompression.
But toojpeg only supports writing the image, not the other way round.
Is there any plan to add the read method to the library ?
Feature idea: allowing the image to be written line by line, so we don't need to allocate a large chunk of memory first.
Thanks for the project. I like its cleanliness.
Is there a way to reverse the result from TooJpeg::writeJpeg
?
E.g.
char org = [100*100*3]; //The input raw image
...
std::vector<char> enc;
//fputc() is the set byte function set to enc
...
auto ok = TooJpeg::writeJpeg(fputc, org, 100, 100, true, 95, true);
...
char recon = [100*100*3]; //The reconstructed image
TooJpeg::readJpeg(enc, ...) //???
I'm not that literate with c++.
Would you be able to supply a sample program showing how to save a simple file? I would like to use your library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.