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

bool "JPGResizeTool"
default n
---help---
Libjpeg JPEG resizer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use tab

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All indents in Kconfig need be tabs, not spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Something is happening that turns them into spaces. I have changed them to tabs. Ill look into this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that your IDE or coding style tool is converting TAB to spaces, which is quite a common feature that doesn't work well with Kconfig files :)

@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()

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) <kevinwit1999@gmail.com>
@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

plcatool.c)
endif()
resize.c)
endif()
Copy link
Contributor

@simbit18 simbit18 Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

5 participants