Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] / [FIX] > Image Converters / Black White filter #11

Merged
merged 8 commits into from
Aug 26, 2023
Merged

[ADD] / [FIX] > Image Converters / Black White filter #11

merged 8 commits into from
Aug 26, 2023

Conversation

VerzatileDev
Copy link
Contributor

@VerzatileDev VerzatileDev commented Aug 26, 2023

Added

  • Jpeg to Bmp converter
  • png to Bmp converter

The following added the possibility to convert an image back to the formats, works the same as bmp to ... converters in the reverse order, the classes need refactoring, but the code as of currently works as intended, also see the Wiki on the setup of PNG library!

Modified

  • Bmp to jpeg converter
  • Bmp to png converter

The problem with the following was that the converted image did not correctly convert the colour format of bmp to jpeg and png, which is not additionally fixed.

That previously either flipped the image upside down or a blue-ish filter was added to the image, each image was separately tested and the filter images were correctly converted!

Fix

Issues

  • There is not check to see if there was an image to convert as of currently and if there was not it just returns to the main part of the code without letting you know, which could additionally be added as a check status to all of the converters!

  • Occasionally some filters add a few pixilation's modifications when converting from one colour format to another, but not always which might an issue with the code or the hardware!

  • Code requires Refactoring and better commenting!

  • Each conversions makes a new file, there should be something that makes the original into temp and modified, and if modified is changed again or a new filter is applied it should save another one to memory or file, instead of making new one for each time button is pressed as of currently the filters used cannot apply multiple filters!

I have Included a wiki directory on how to include the following library to use the function, though it produces a wrong result at the current time being, i have left the test functions as required and updated the Tasks.json / c_cpp_properties.json in the wiki.
In the following Code there was an issue that the converted image's colour was changed and the original format of the image was refused applying a blue filter on it.

Which was due to the BMP colour pallet being different to the one of JPEG, which requires the use of a converter.  Which was inproper.
Additionally added a line to properly convert from BMP colour variant to the PNG colour variant, previously the image turned blue.

This version now Fixes it for any filtered image.
(Left in the commented out Functionality for them for testing purposes).

- See how to add the library in the wiki!
Additionally added a class that converts png back to a bmp format, converting the colour format of the image to proper form.
Added a function jpeg_to_bmp that converts JPEG images to BMP format. The function reads the input JPEG file, initializes a JPEG decompressor, and extracts image dimensions and pixel data. It then constructs a BMP header, calculates the BMP file size, and writes the header to the output BMP file. The JPEG pixel data is rearranged and written in RGB order to the BMP file. Padding is added as needed to align rows on a 4-byte boundary. The function ensures memory is properly managed, closes files, and provides conversion status output.
@VerzatileDev VerzatileDev added the enhancement New feature or request label Aug 26, 2023
@VerzatileDev VerzatileDev requested a review from Sommos August 26, 2023 13:58
Comments not necessary in the main.c are now removed from testing.
The display had a wrong image being displayed in the code and due to that reason it was not being displayed.
@VerzatileDev VerzatileDev linked an issue Aug 26, 2023 that may be closed by this pull request
@VerzatileDev VerzatileDev changed the title [ADD] / [FIX] > Image Converters [ADD] / [FIX] > Image Converters / Black White filter Aug 26, 2023
Comments are now smaller than ever and are no longer capitalized
@Sommos
Copy link
Contributor

Sommos commented Aug 26, 2023

Looks good to me!

@Sommos Sommos closed this Aug 26, 2023
@Sommos Sommos reopened this Aug 26, 2023
@Sommos Sommos merged commit 571222f into VerzatileDevOrg:main Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] - Black and White Filter
2 participants