Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@
*.tim
*.bmp
obj
gh-pages
gh-pages
.idea
cmake-build-debug
CMakeFiles
cmake_install.cmake
CMakeCache.txt
Makefile
Img2TIM
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.10)

project(Img2TIM VERSION 1.0)

# Debug
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g -O1")

# C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CXXFLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++20")
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_VERBOSE_MAKEFILE ON)

# PkgConfig
find_package(PkgConfig REQUIRED)

# Mark executable
add_executable(Img2TIM "main.cpp" "tim.cpp")
target_include_directories(Img2TIM PRIVATE "tim.h")

# FreeImage
# find_package(FreeImage CONFIG REQUIRED)
pkg_check_modules(FreeImage REQUIRED IMPORTED_TARGET GLOBAL freeimage)
target_link_libraries(Img2TIM PRIVATE PkgConfig::FreeImage)
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,31 @@ The latest precompiled Win32 binary of this program can be downloaded here:
Previous versions:
[img2tim_(v0.60).zip](http://lameguy64.github.io/img2tim/img2tim_(v0.60).zip)

## Compiling

This project relies on `PkgConfig` to resolve the necessary dependencies. Esnure that
it is present on your system and the `freeimage` library is installed.

To initialise the project, run:
```shell
cmake -B ./build .
```

If need be you can directly specify the toolchain if you are using vcpkg:

```shell
cmake -DCMAKE_TOOLCHAIN_FILE=<path to vcpkg>/vcpkg/scripts/buildsystems/vcpkg.cmake -B ./build .
```

Then run the program via:
```shell
./build/Img2TIM <args>
```

## Changelog
**Version 0.75**
* Fixed a bug where a false error message is thrown when converting 4-bit images with -bpp 4.
* Fixed a pixel order bug when converting images from either RGB or 4-bit depth to 4-bit color depth.

**Version 0.60**
* Initial release.
* Initial release.
10 changes: 10 additions & 0 deletions freeimage.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prefix=/opt/homebrew/Cellar/freeimage/3.18.0
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib

Name: FreeImage
Description: FreeImage Library
Version: 3.18.0
Cflags: -I${includedir}
Libs: -L${libdir} -lfreeimage
3 changes: 3 additions & 0 deletions tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <windows.h>
#endif
#include <math.h>
#if defined(__APPLE__) || defined(linux)
#include <sys/types.h>
#endif

#define TIM_OUTPUT_CLUT4 0
#define TIM_OUTPUT_CLUT8 1
Expand Down