Skip to content

Conversation

@keever50
Copy link
Contributor

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.
image
image

@keever50
Copy link
Contributor Author

Also this tool allows a denom of 16, which is not possible. Should be removed.

linguini1
linguini1 previously approved these changes Oct 14, 2025
@keever50
Copy link
Contributor Author

Ill get back to this later this week if the tweaks are still required!

@linguini1
Copy link
Contributor

Ill get back to this later this week if the tweaks are still required!

That would be great!

@simbit18
Copy link
Contributor

Hi @keever50 , Please add build with CMake

@keever50
Copy link
Contributor Author

@simbit18 Hi, I'm not familiar with CMake in NuttX and I'm not sure how to get this to work with my current project, so I cannot test the addition of this. I hope it is okay to leave this out for now.

@simbit18
Copy link
Contributor

simbit18 commented Oct 19, 2025

@simbit18 Hi, I'm not familiar with CMake in NuttX and I'm not sure how to get this to work with my current project, so I cannot test the addition of this. I hope it is okay to leave this out for now.

Hi @keever50, add

# ##############################################################################
# apps/graphics/jpgresizetool/CMakeLists.txt
#
# 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.
#
# ##############################################################################

if(CONFIG_GRAPHICS_JPGRESIZETOOL)
  nuttx_add_application(
    NAME
    jpgresize
    STACKSIZE
    4096
    MODULE
    ${CONFIG_GRAPHICS_JPGRESIZETOOL}
    SRCS
    resize.c)
endif()

@keever50
Copy link
Contributor Author

@simbit18 Hi, I'm not familiar with CMake in NuttX and I'm not sure how to get this to work with my current project, so I cannot test the addition of this. I hope it is okay to leave this out for now.

Hi @keever50, add

# ##############################################################################
# apps/graphics/jpgresizetool/CMakeLists.txt
#
# 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.
#
# ##############################################################################

if(CONFIG_GRAPHICS_JPGRESIZETOOL)
  nuttx_add_application(
    NAME
    jpgresize
    STACKSIZE
    4096
    MODULE
    ${CONFIG_GRAPHICS_JPGRESIZETOOL}
    SRCS
    resize.c)
endif()

Thanks, done!

@simbit18
Copy link
Contributor

Hi @keever50 , could you add some basic documentation?

https://nuttx.apache.org/docs/latest/applications/graphics/index.html

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]>
@xiaoxiang781216 xiaoxiang781216 merged commit 452ae23 into apache:master Oct 26, 2025
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants