Skip to content

Commit

Permalink
fix to jpeg bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed May 11, 2024
1 parent da175cb commit df00226
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/vision/include/maix_image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ namespace maix::image
* @param quality the quality of jpg, default is 95. range is (50, 100].
* @return new image object. Need be delete by caller in C++.
* @throw err.Exception, if two images' format not support, **or already the format**, will raise exception
* @maixcdk maix.image.Image.to_jpeg
* @maixpy maix.image.Image.to_jpeg
*/
image::Image *to_jpeg(int quality = 95);

Expand Down
4 changes: 2 additions & 2 deletions components/vision/src/maix_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ namespace maix::image
{
#ifdef PLATFORM_MAIXCAM
image::Image *img = nullptr;
if (!mmf_enc_jpg_push(0, (uint8_t *)_data, _width, _height, mmf_invert_format_to_mmf(image::FMT_YVU420SP))) {
if (!mmf_enc_jpg_push_with_quality(0, (uint8_t *)_data, _width, _height, mmf_invert_format_to_mmf(image::FMT_YVU420SP), 95)) {
uint8_t *data;
int data_size;
if (!mmf_enc_jpg_pop(0, &data, &data_size)) {
Expand All @@ -426,7 +426,7 @@ namespace maix::image
p_img = this;
}

if (!mmf_enc_jpg_push(0, (uint8_t *)p_img->data(), _width, _height, mmf_invert_format_to_mmf(image::FMT_RGB888))) {
if (!mmf_enc_jpg_push_with_quality(0, (uint8_t *)p_img->data(), _width, _height, mmf_invert_format_to_mmf(image::FMT_RGB888), 80)) {
uint8_t *data;
int data_size;
if (!mmf_enc_jpg_pop(0, &data, &data_size)) {
Expand Down

0 comments on commit df00226

Please sign in to comment.