-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,352 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# gimp-jxr | ||
GIMP plugin for reading and writing of JPEG XR image files. The plugin is also available on the [GIMP Plugin Registry](http://registry.gimp.org/node/25508). | ||
|
||
[![license](https://img.shields.io/github/license/chausner/gimp-jxr.svg)](https://github.com/chausner/gimp-jxr/blob/master/LICENSE) | ||
|
||
**NOTE:** Version 2.0 currently has a bug and writes non-standard files (that won't open in any other application) when the source image has an alpha channel. This will be fixed in a follow-up release. | ||
|
||
Features | ||
-------- | ||
Almost all pixel formats supported by JPEG XR can be loaded. Incompatible formats, however, will first be converted to a representation that GIMP understands (this means you'll loose HDR data, for example). All RGB pixel formats are converted to 24bpp RGB, all RGBA formats to 32bpp BGRA, and all grayscale formats to 8bpp Gray. Black-white images are imported as indexed images. | ||
|
||
Images are saved in one of the following pixel formats: | ||
* 1bpp BlackWhite, if image mode is set to Indexed and the color map has exactly two entries black and white | ||
* 8bpp Grayscale, for grayscale images | ||
* 24bpp RGB, for color images without alpha channel | ||
* 32bpp RGBA, for color images with alpha channel | ||
|
||
Save options include: | ||
* Image quality | ||
* Alpha channel quality | ||
* Overlap¹ | ||
* Chroma subsampling¹ | ||
* Tiling¹ | ||
|
||
¹ see [jxrlib](http://jxrlib.codeplex.com) documentation for more information | ||
|
||
Installation | ||
------------ | ||
The plugin is designed to run with GIMP version 2.8.x. | ||
|
||
### Windows | ||
Take the [pre-compiled binary](https://github.com/chausner/gimp-jxr/releases/latest) and put it into "%USERPROFILE%\\.gimp-2.8\plug-ins" (create the folder if it doesn't exist). Alternatively, run ```<GIMP installation dir>\bin\gimptool-2.0.exe --install-bin <path to plugin binary>```. | ||
|
||
### Ubuntu | ||
1. Make sure GIMP 2.8.x is installed and you have all required development files: | ||
``` | ||
sudo apt-get install libgimp2.0-dev libjxr0 libjxr-dev | ||
``` | ||
|
||
2. Grab the gimp-jxr source code via git: | ||
``` | ||
git clone https://github.com/chausner/gimp-jxr.git | ||
``` | ||
|
||
3. Compile and install gimp-jxr: | ||
``` | ||
cd gimp-jxr/src | ||
export CFLAGS='-w -O -I/usr/include/jxrlib -D__ANSI__ -DDISABLE_PERF_MEASUREMENT load.c save.c utils.c' | ||
export LIBS='-ljxrglue -ljpegxr' | ||
gimptool-2.0 --install file-jxr.c | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include "file-jxr.h" | ||
|
||
static void query(); | ||
static void run(const gchar* name, gint nparams, const GimpParam* param, gint* nreturn_vals, GimpParam** return_vals); | ||
void load(gint nparams, const GimpParam* param, gint* nreturn_vals, GimpParam** return_vals); | ||
void save(gint nparams, const GimpParam* param, gint* nreturn_vals, GimpParam** return_vals); | ||
|
||
const GimpPlugInInfo PLUG_IN_INFO = | ||
{ | ||
NULL, | ||
NULL, | ||
(GimpQueryProc)query, | ||
(GimpRunProc)run, | ||
}; | ||
|
||
G_BEGIN_DECLS | ||
|
||
MAIN() | ||
|
||
static void query() | ||
{ | ||
static const GimpParamDef load_args[] = | ||
{ | ||
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, | ||
{ GIMP_PDB_STRING, "filename", "The name of the file to load" }, | ||
{ GIMP_PDB_STRING, "raw-filename", "The name entered" } | ||
}; | ||
|
||
static const GimpParamDef load_return_vals[] = | ||
{ | ||
{ GIMP_PDB_IMAGE, "image", "Output image" } | ||
}; | ||
|
||
static const GimpParamDef save_args[] = | ||
{ | ||
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, | ||
{ GIMP_PDB_IMAGE, "image", "Input image" }, | ||
{ GIMP_PDB_DRAWABLE,"drawable", "Drawable to save" }, | ||
{ GIMP_PDB_STRING, "filename", "The name of the file to save the image in" }, | ||
{ GIMP_PDB_STRING, "raw-filename", "The name entered" }, | ||
{ GIMP_PDB_INT32, "quality", "Quality of saved image (0 <= quality <= 100, 100 = lossless)" }, | ||
{ GIMP_PDB_INT32, "alpha-quality", "Quality of alpha channel (0 <= quality <= 100, 100 = lossless)" }, | ||
{ GIMP_PDB_INT32, "overlap", "Overlap level (0 = auto, 1 = none, 2 = one level, 3 = two level)" }, | ||
{ GIMP_PDB_INT32, "subsampling", "Chroma subsampling (0 = Y-only, 1 = 4:2:0, 2 = 4:2:2, 3 = 4:4:4)" }, | ||
{ GIMP_PDB_INT32, "tiling", "Tiling (0 = none, 1 = 256 x 256, 2 = 512 x 512, 3 = 1024 x 1024)" }, | ||
}; | ||
|
||
gimp_install_procedure(LOAD_PROC, | ||
N_("Loads JPEG XR images"), | ||
"Loads JPEG XR image files.", | ||
"Christoph Hausner", | ||
"Christoph Hausner", | ||
"2013", | ||
N_("JPEG XR image"), | ||
NULL, | ||
GIMP_PLUGIN, | ||
G_N_ELEMENTS(load_args), | ||
G_N_ELEMENTS(load_return_vals), | ||
load_args, load_return_vals); | ||
|
||
gimp_register_file_handler_mime(LOAD_PROC, "image/vnd.ms-photo"); | ||
gimp_register_magic_load_handler(LOAD_PROC, "jxr,wdp,hdp", "", "0,string,II\xBC"); | ||
|
||
gimp_install_procedure(SAVE_PROC, | ||
N_("Saves JPEG XR images"), | ||
"Saves JPEG XR image files.", | ||
"Christoph Hausner", | ||
"Christoph Hausner", | ||
"2013", | ||
N_("JPEG XR image"), | ||
"RGB*, GRAY, INDEXED", | ||
GIMP_PLUGIN, | ||
G_N_ELEMENTS(save_args), 0, | ||
save_args, 0); | ||
|
||
gimp_register_save_handler(SAVE_PROC, "jxr", ""); | ||
gimp_register_file_handler_mime(SAVE_PROC, "image/vnd.ms-photo"); | ||
} | ||
|
||
static void run(const gchar* name, gint nparams, const GimpParam* param, gint* nreturn_vals, GimpParam** return_vals) | ||
{ | ||
if (strcmp(name, LOAD_PROC) == 0) | ||
load(nparams, param, nreturn_vals, return_vals); | ||
else if (strcmp(name, SAVE_PROC) == 0) | ||
save(nparams, param, nreturn_vals, return_vals); | ||
} | ||
|
||
G_END_DECLS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef FILE_JXR_H | ||
#define FILE_JXR_H | ||
|
||
#include <string.h> | ||
#include <libgimp/gimp.h> | ||
|
||
#define LOAD_PROC "file-jxr-load" | ||
#define SAVE_PROC "file-jxr-save" | ||
#define PLUG_IN_BINARY "file-jxr" | ||
|
||
#define _(String) (String) | ||
#define N_(String) (String) | ||
|
||
#endif |
Oops, something went wrong.