Image processing in C
-
Can anyone suggest me, how to implement program that break (.png) image in two equal part?
-
Can anyone suggest me, how to implement program that break (.png) image in two equal part?
Use a library that supports reading and writing PNG files. When reading you will get an uncrompressed bitmap in memory that can be modified and written again. In your case just create two new bitmaps by copying the areas of interest from the input bitmap. But there are existing command line tools that can do what you want. An example is ImageMagick: Convert, Edit, Or Compose Bitmap Images[^] (see crop at ImageMagick: Command-line Options[^]). See Fred's ImageMagick Scripts: SPLITCROP[^] for a small script that will do what you want.
-
Can anyone suggest me, how to implement program that break (.png) image in two equal part?
If you're able to, you really should consider leveraging c++ for this task. Doing so allows you to use functionality built into windows for well over a decade - GDI+. GDI+ allows one to read formats windows supports natively, also including methods that facilitate the saving of bitmap images to files on disk.
-
Can anyone suggest me, how to implement program that break (.png) image in two equal part?
-
If you're able to, you really should consider leveraging c++ for this task. Doing so allows you to use functionality built into windows for well over a decade - GDI+. GDI+ allows one to read formats windows supports natively, also including methods that facilitate the saving of bitmap images to files on disk.
He has asked for C and he said nothing about Windows so why bring up Windows/GDI ... You need to remember not everything that is requested is for a PC and often not on Windows. It's highly possible he doesn't have a C++ compiler available or even as an option for what he is working on. There is a very large embedded industry out there and almost none of those micro-controllers and processors have a C++ compiler available. Don't make assumptions about what he is doing.
In vino veritas
-
Same comment as above the poster said nothing about being on Windows. Why would you assume he has it available? He asked to split a PNG file with C code that was it.
In vino veritas
-
Can anyone suggest me, how to implement program that break (.png) image in two equal part?
Okay so in C you will find references to libpng which was done for a computer book all over the internet, it is a platform-independent library that contains C functions for handling PNG images that is 20 years old. Technically the code is ANSI C (C89) which should run on most C compilers even those for micro-controllers. It isn't bad and easily understandable. You will often find more up to date conversion of the original code but it's more often you will run across the read implementation than the write. The code to use the png library isn't hard as you will see A simple libpng example program[^] You download the png library from the pnglib homepage libpng Home Page[^] There are manuals and "howto" instructions and pages there.
In vino veritas
-
Same comment as above the poster said nothing about being on Windows. Why would you assume he has it available? He asked to split a PNG file with C code that was it.
In vino veritas
-
He has asked for C and he said nothing about Windows so why bring up Windows/GDI ... You need to remember not everything that is requested is for a PC and often not on Windows. It's highly possible he doesn't have a C++ compiler available or even as an option for what he is working on. There is a very large embedded industry out there and almost none of those micro-controllers and processors have a C++ compiler available. Don't make assumptions about what he is doing.
In vino veritas
Simple. He didn't explicitly say they would be no good. CodProject is, as you're no doubt fully aware, an MS-centric site. It's also not uncommon for new members to be less explicit than would be beneficial. I don't need to remember anything pal. I'm fully aware that plenty of articles here are for Arduino projects. No-poop sherlock. I've spent time in it myself. Go back and read my post, ya dolt. Here, I've saved you the trouble. I even highlighted the important parts you seemed to have made your own assumptions about. If you're able to, you really should consider leveraging c++ for this task. The only assumption I made was that all offerings of help made in good faith would be gratefully received - not necessarily useful, but received gratefully all the same. Go and get a dog up ya
-
Simple. He didn't explicitly say they would be no good. CodProject is, as you're no doubt fully aware, an MS-centric site. It's also not uncommon for new members to be less explicit than would be beneficial. I don't need to remember anything pal. I'm fully aware that plenty of articles here are for Arduino projects. No-poop sherlock. I've spent time in it myself. Go back and read my post, ya dolt. Here, I've saved you the trouble. I even highlighted the important parts you seemed to have made your own assumptions about. If you're able to, you really should consider leveraging c++ for this task. The only assumption I made was that all offerings of help made in good faith would be gratefully received - not necessarily useful, but received gratefully all the same. Go and get a dog up ya
I have no idea why you feel the rant is necessary .. I have referred it to admin I found your comment strange for the following reasons, so we are clear 1.) The original PNG library was written in C and is still maintained (20 years so far) 2.) It's dubious there is any advantage on converting PNGLIB to C++ you are just likely to get bugs any C++ compiler can compile PNGLIB anyhow 3.) The OP said nothing about windows 4.) Even if you are on windows the GDI+ does not support PNG because it is licenced .. SEE => PNGLIB. Even IPicture which support JPG and GIF does not support PNG. So you would still have to write your own GDI+ extension code. There is no malice intended, I just think your advice was misguided for the above reasons. Now if I am in error on any of those points then please let me know.
In vino veritas