![]() |
![]() |
castle-view-image
is an image viewer, converter and even
a very limited image editor.
If you already have Castle Game Engine, then just run castle-view-image
executable in CGE bin
subdirectory. There's no need to download it separately.
Documentation:
castle-view-image
was originally developed to demonstrate
the power of image handling inside our Castle Game Engine. It became quite useful utility on it's own, with the following features:
N
, P
for next, previous).
Many image formats are supported:
PNG: Portable Network Graphic. Excellent open format for images, offering good lossless image compression, full alpha channel if you need it, supported by almost every other image software in the world.
Loaded using LibPNG, with a fallback (in case LibPNG is missing) on Pascal loaders in FPC fcl-image or Vampyre Imaging Library.
JPEG, GIF, TGA, XPM, PSD, PCX, PNM, PBM, PGM, PPM.
Loaded using FPC fcl-image library or Vampyre Imaging Library (depending on your compiler and configuration).
Note: We do not recommend using PSD images in CGE data. While it works, PSD is still an internal file format that is really implemented perfectly only by Photoshop. It's like XCF in GIMP, like BLEND in Blender, like MAX in 3ds Max... Applications are not really supposed to be able to read these formats, they are complicated (if one would strive to handle 100% of their features). Our PSD readers support some common features, they for sure don't support 100% of PSD features.
You of course can use Photoshop, and save your files as PSD for development. But then export them to PNG for CGE to read. That's a normal workflow, for usage of PSD anywhere (not only in CGE). PSD is not a final format, it is a development format, like a source code -> you want to export it to something else to use it (PNG is usually the best choice, full-featured and lossless).
Note: For most of the above formats, PNG is a better alternative. E.g. PNG will result in smaller file size (without losing any features) compared to PNM, PBM, PGM, PPM, XCF. PNG will be loaded much much faster than XCF (text-only format that is very slow to load). PNG is more widely supported and has proper specification, unlike PCX.
KTX: Khronos Texture format.
Excellent image format to utilize various graphic features, like GPU compression (images stay compressed in GPU memory), explicit mipmaps, cube maps, volume (3D) textures. Details about using KTX format for textures in our engine are here.
With castle-view-image
you can view all subimages
within one DDS file, see menu items
Images->Next/Previous Subimage in composite (DDS, KTX).
DDS: Direct Draw Surface. Similar to KTX. Saving to DDS images is also supported. Details about using DDS format for textures in our engine are here.
RGBE: Simple HDR (high dynamic range) format. The format name is an acronym for Red + Green + Blue + Exponent, it was developed by by Greg Ward, described in "Graphic Gems II", used e.g. in Radiance.
It makes sense to use this if you need data in floating-point format,
e.g. to load it to TRGBFloatImage
.
BMP: Windows Bitmap. Native support. Only for non-compressed (RLE compressed are not handled).
IPL: IPLab image format. Only 16 bits per pixel are supported (gray-scale). Deprecated: Due to the fact that it has probably 0 usage nowadays. Let me know on forum or Discord if you use this image format and want to keep using it.
You can simply run the castle-view-image
without parameters,
and open / save images using the menu commands.
Keys not available as menu items: | |
---|---|
Arrows | move image |
Arrows + Ctrl | move image 10 x faster |
- / + | scale image (smaller / larger) |
x / X | scale only horizontally (smaller / larger) |
y / Y | scale only vertically (smaller / larger) |
Notes about opening image:
castle-view-image guesses image format using file extension (yes, yes,
I will change it at some time to recognize image format based on
file content), so it's important for files to have good
filename extension. JPEG images may have extension jpg
or jpeg
, RGBE images - rgbe
or pic
,
rest is obvious.
Opened image is also added to the image list.
castle-view-image remembers image list that you can browse using N (next image on the list) and P (previous image on the list) keys. When you run castle-view-image you can give it as parameters a list of images to browse.
Every parameter must be one of:
A directory name — castle-view-image will display all images found in this directory.
E.g. run castle-view-image ~/my_images/
to display
all images in ~/my_images/
directory.
A filename — castle-view-image will display this image, and also allow to browse (by previous/next) other images in the same directory.
@<filename>
— castle-view-image will read
image filenames from file <filename>
,
each line is one filename
(<filename>
"-" means "standard input", as usual;
so you can pipe output of e.g. find
program to castle-view-image).
Running castle-view-image
with no parameters is equivalent
to running
castle-view-image .
so you will view all images (that castle-view-image can handle) in the current directory.
If none found, the default welcome image will be displayed.
Oh, and (as usual) all parameters described in those pages:
standard options understood by my OpenGL programs and some notes about command-line options understood by my programs are available. If you will not give any parameter that forces some
window size (like --geometry
) then program will open a window
with the same size as the first displayed image.
Resulting image format is determined by filename extension, unknown extension will result in error.
Image loaded and displayed by castle-view-image is internally always stored in format comfortable for OpenGL. This includes many formats, but not RGBE. It means that if you will load RGBE image to castle-view-image and then you will save it (even to the RGBE format again) then you loose RGBE precision (and clamp color values above 1.0).
Also, S3TC compressed images (from KTX, DDS files) will be always decompressed, and saving them back will always make uncompressed files.
convert
program from
ImageMagick
package must be available on $PATH for some image formats to work.