-
Notifications
You must be signed in to change notification settings - Fork 658
graphics/jpgresizetool: Add libjpeg resize tool #3143
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
base: master
Are you sure you want to change the base?
Conversation
Add a libjpeg based JPEG resize tool. Simple resizer that can resize JPEGs using "jpgresize input.jpg output.jpg scale_denom(1,2,4,8) quality%". Tries to use little memory by scanning per line. Signed-off-by: Kevin Witteveen (MartiniMarter) <[email protected]>
# | ||
|
||
config GRAPHICS_JPGRESIZETOOL | ||
bool "JPGResizeTool" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add depends on libjpeg
bool "JPGResizeTool" | ||
default n | ||
---help--- | ||
Libjpeg JPEG resizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use tab
|
||
/* Configuring decompressor */ | ||
|
||
struct jpeg_decompress_struct cinfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need move all variables definition to the begin of function to confirm to c89 spec.
|
||
/* All done */ | ||
|
||
printf("\rDone\n\r"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove \r
from all code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, why do I need to remove \r? This makes printing behave very differently. I want the cursor to return to the beginning of the line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serial driver already do the conversion for you:
https://github.com/apache/nuttx/blob/master/drivers/serial/serial.c#L417-L433
you don't do it again in the code manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The single '\r' is intended in some parts of the code.
However, I can probably replace \n\r
to \n
. But keep single \r
as is.
This is so we can reuse the same line to progress the loading bar instead of spawning a new loading bar on every new line. Your entire terminal would be filled up with loading bars otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
Also this tool allows a denom of 16, which is not possible. Should be removed. |
@@ -0,0 +1,3 @@ | |||
ifneq ($(CONFIG_GRAPHICS_JPGRESIZETOOL),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keever50 missing
############################################################################
# apps/graphics/jpgresizetool/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
Summary
Add a libjpeg based JPEG resize tool.
Simple resizer that can resize JPEGs using
"jpgresize input.jpg output.jpg scale_denom(1,2,4,8) quality%". Tries to use little memory by scanning per line.
Impact
Allows users to quickly resize JPEG images using a simple command. Useful for in scripts to generate thumbnails or experiment with jpeg compression and size ratios.
Testing
This app is tested during the development of a project where thumbnails are generated from photos.

