Permalink
Browse files

initial commit

  • Loading branch information...
1 parent 5cb2d98 commit f99a2ce8266d96a5ee5997c8a6455d7c440cb0e9 @mikeseven committed Apr 20, 2012
Showing with 748 additions and 1 deletion.
  1. +55 −0 LICENSES
  2. +9 −1 README.md
  3. +122 −0 lib/image.js
  4. +65 −0 package.json
  5. +139 −0 src/FreeImage.cpp
  6. +44 −0 src/FreeImage.h
  7. +133 −0 src/Image.cpp
  8. +45 −0 src/Image.h
  9. +23 −0 src/bindings.cpp
  10. +60 −0 src/common.h
  11. BIN test/mike_scooter.jpg
  12. +18 −0 test/test.js
  13. +35 −0 wscript
View
@@ -0,0 +1,55 @@
+This document lists all the licenses used in this node-image repository:
+
+- Part I - node-image distributed under BSD license
+
+While not included in this distribution since no modified version of FreeImage is needed, this software uses the FreeImage open source image library. See http://freeimage.sourceforge.net for details.
+FreeImage is used under the FIPL version 1.0.
+
+------------------------------------------------------------------------------
+Part I - node-image distributed under BSD license
+
+Copyright (c) 2011-2012, Mikael Bourges-Sevenier
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+------------------------------------------------------------------------------
+Part II - LightGL.js from Evan Wallace under MIT license
+
+Copyright (C) 2011 by Evan Wallace
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -1,4 +1,12 @@
node-image
==========
+A wrapper around FreeImage library.
+
+Really incomplete, only for jpeg/png read/write and processing of raw pixels.
+
+Requirements
+------------
+- libfreeimage-dev, at least 3.15.0
+- node.js, at least 0.5.9
+
-A quick Node.JS wrapper around FreeImage
View
@@ -0,0 +1,122 @@
+var freeimage = require(__dirname + "/../build/Release/image");
+
+exports.Image = new freeimage.FreeImage();
+
+//image formats
+exports.Image.FIF_UNKNOWN = -1;
+exports.Image.FIF_BMP = 0;
+exports.Image.FIF_ICO = 1;
+exports.Image.FIF_JPEG = 2;
+exports.Image.FIF_JNG = 3;
+exports.Image.FIF_KOALA = 4;
+exports.Image.FIF_LBM = 5;
+exports.Image.FIF_IFF = exports.Image.FIF_LBM;
+exports.Image.FIF_MNG = 6;
+exports.Image.FIF_PBM = 7;
+exports.Image.FIF_PBMRAW = 8;
+exports.Image.FIF_PCD = 9;
+exports.Image.FIF_PCX = 10;
+exports.Image.FIF_PGM = 11;
+exports.Image.FIF_PGMRAW = 12;
+exports.Image.FIF_PNG = 13;
+exports.Image.FIF_PPM = 14;
+exports.Image.FIF_PPMRAW = 15;
+exports.Image.FIF_RAS = 16;
+exports.Image.FIF_TARGA = 17;
+exports.Image.FIF_TIFF = 18;
+exports.Image.FIF_WBMP = 19;
+exports.Image.FIF_PSD = 20;
+exports.Image.FIF_CUT = 21;
+exports.Image.FIF_XBM = 22;
+exports.Image.FIF_XPM = 23;
+exports.Image.FIF_DDS = 24;
+exports.Image.FIF_GIF = 25;
+exports.Image.FIF_HDR = 26;
+exports.Image.FIF_FAXG3 = 27;
+exports.Image.FIF_SGI = 28;
+exports.Image.FIF_EXR = 29;
+exports.Image.FIF_J2K = 30;
+exports.Image.FIF_JP2 = 31;
+exports.Image.FIF_PFM = 32;
+exports.Image.FIF_PICT = 33;
+exports.Image.FIF_RAW = 34;
+
+//Load / Save flag constants -----------------------------------------------
+exports.Image.BMP_DEFAULT =0;
+exports.Image.BMP_SAVE_RLE =1;
+exports.Image.CUT_DEFAULT =0;
+exports.Image.DDS_DEFAULT =0;
+exports.Image.EXR_DEFAULT =0; // save data as half with piz-based wavelet compression
+exports.Image.EXR_FLOAT =0x0001; // save data as float instead of as half (not recommended)
+exports.Image.EXR_NONE =0x0002; // save with no compression
+exports.Image.EXR_ZIP =0x0004; // save with zlib compression, in blocks of 16 scan lines
+exports.Image.EXR_PIZ =0x0008; // save with piz-based wavelet compression
+exports.Image.EXR_PXR24 =0x0010; // save with lossy 24-bit float compression
+exports.Image.EXR_B44 =0x0020; // save with lossy 44% float compression - goes to 22% when combined with EXR_LC
+exports.Image.EXR_LC =0x0040; // save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
+exports.Image.FAXG3_DEFAULT =0;
+exports.Image.GIF_DEFAULT =0;
+exports.Image.GIF_LOAD256 =1; // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
+exports.Image.GIF_PLAYBACK =2; // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
+exports.Image.HDR_DEFAULT =0;
+exports.Image.ICO_DEFAULT =0;
+exports.Image.ICO_MAKEALPHA =1; // convert to 32bpp and create an alpha channel from the AND-mask when loading
+exports.Image.IFF_DEFAULT =0;
+exports.Image.J2K_DEFAULT =0; // save with a 16:1 rate
+exports.Image.JP2_DEFAULT =0; // save with a 16:1 rate
+exports.Image.JPEG_DEFAULT =0; // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
+exports.Image.JPEG_FAST =0x0001; // load the file as fast as possible, sacrificing some quality
+exports.Image.JPEG_ACCURATE =0x0002; // load the file with the best quality, sacrificing some speed
+exports.Image.JPEG_CMYK =0x0004; // load separated CMYK "as is" (use | to combine with other load flags)
+exports.Image.JPEG_EXIFROTATE =0x0008; // load and rotate according to Exif 'Orientation' tag if available
+exports.Image.JPEG_QUALITYSUPERB =0x80; // save with superb quality (100:1)
+exports.Image.JPEG_QUALITYGOOD =0x0100; // save with good quality (75:1)
+exports.Image.JPEG_QUALITYNORMAL =0x0200; // save with normal quality (50:1)
+exports.Image.JPEG_QUALITYAVERAGE =0x0400; // save with average quality (25:1)
+exports.Image.JPEG_QUALITYBAD =0x0800; // save with bad quality (10:1)
+exports.Image.JPEG_PROGRESSIVE =0x2000; // save as a progressive-JPEG (use | to combine with other save flags)
+exports.Image.JPEG_SUBSAMPLING_411 =0x1000; // save with high 4x1 chroma subsampling (4:1:1)
+exports.Image.JPEG_SUBSAMPLING_420 =0x4000; // save with medium 2x2 medium chroma subsampling (4:2:0) - default value
+exports.Image.JPEG_SUBSAMPLING_422 =0x8000; // save with low 2x1 chroma subsampling (4:2:2)
+exports.Image.JPEG_SUBSAMPLING_444 =0x10000; // save with no chroma subsampling (4:4:4)
+exports.Image.KOALA_DEFAULT =0;
+exports.Image.LBM_DEFAULT =0;
+exports.Image.MNG_DEFAULT =0;
+exports.Image.PCD_DEFAULT =0;
+exports.Image.PCD_BASE =1; // load the bitmap sized 768 x 512
+exports.Image.PCD_BASEDIV4 =2; // load the bitmap sized 384 x 256
+exports.Image.PCD_BASEDIV16 =3; // load the bitmap sized 192 x 128
+exports.Image.PCX_DEFAULT =0;
+exports.Image.PFM_DEFAULT =0;
+exports.Image.PICT_DEFAULT =0;
+exports.Image.PNG_DEFAULT =0;
+exports.Image.PNG_IGNOREGAMMA =1; // loading: avoid gamma correction
+exports.Image.PNG_Z_BEST_SPEED =0x0001; // save using ZLib level 1 compression flag (default value is 6)
+exports.Image.PNG_Z_DEFAULT_COMPRESSION =0x0006; // save using ZLib level 6 compression flag (default recommended value)
+exports.Image.PNG_Z_BEST_COMPRESSION =0x0009; // save using ZLib level 9 compression flag (default value is 6)
+exports.Image.PNG_Z_NO_COMPRESSION =0x0100; // save without ZLib compression
+exports.Image.PNG_INTERLACED =0x0200; // save using Adam7 interlacing (use | to combine with other save flags)
+exports.Image.PNM_DEFAULT =0;
+exports.Image.PNM_SAVE_RAW =0; // If set the writer saves in RAW format (i.e. P4, P5 or P6)
+exports.Image.PNM_SAVE_ASCII =1; // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
+exports.Image.PSD_DEFAULT =0;
+exports.Image.RAS_DEFAULT =0;
+exports.Image.RAW_DEFAULT =0; // load the file as linear RGB 48-bit
+exports.Image.RAW_PREVIEW =1; // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
+exports.Image.RAW_DISPLAY =2; // load the file as RGB 24-bit
+exports.Image.SGI_DEFAULT =0;
+exports.Image.TARGA_DEFAULT =0;
+exports.Image.TARGA_LOAD_RGB888 =1; // If set the loader converts RGB555 and ARGB8888 -> RGB888.
+exports.Image.TIFF_DEFAULT =0;
+exports.Image.TIFF_CMYK =0x0001; // reads/stores tags for separated CMYK (use | to combine with compression flags)
+exports.Image.TIFF_PACKBITS =0x0100; // save using PACKBITS compression
+exports.Image.TIFF_DEFLATE =0x0200; // save using DEFLATE compression (a.k.a. ZLIB compression)
+exports.Image.TIFF_ADOBE_DEFLATE =0x0400; // save using ADOBE DEFLATE compression
+exports.Image.TIFF_NONE =0x0800; // save without any compression
+exports.Image.TIFF_CCITTFAX3 =0x1000; // save using CCITT Group 3 fax encoding
+exports.Image.TIFF_CCITTFAX4 =0x2000; // save using CCITT Group 4 fax encoding
+exports.Image.TIFF_LZW =0x4000; // save using LZW compression
+exports.Image.TIFF_JPEG =0x8000; // save using JPEG compression
+exports.Image.WBMP_DEFAULT =0;
+exports.Image.XBM_DEFAULT =0;
+exports.Image.XPM_DEFAULT =0;
View
@@ -0,0 +1,65 @@
+{
+ "name": "node-image",
+ "version": "0.5.0",
+ "description": "A Node.JS wrapper around FreeImage",
+ "main": "lib/image.js",
+ "author": "Mikael Bourges-Sevenier <mikeseven@gmail.com>",
+ "keywords": [
+ "jpeg",
+ "jpg",
+ "png",
+ "gif",
+ "bmp",
+ "jng",
+ "pnm",
+ "ppm",
+ "tga",
+ "tiff",
+ "psd",
+ "xbm",
+ "xpm",
+ "j2k",
+ "jpeg2000",
+ "jp2",
+ "sgi",
+ "exr",
+ "hdr",
+ "pict",
+ "raw",
+ "ico",
+ "wbmp",
+ "image",
+ "picture"
+ ],
+ "maintainers": [
+ {
+ "name": "Mikael Bourges-Sevenier",
+ "email": "mikeseven@gmail.com",
+ "twitter": "msevenier"
+ }
+ ],
+ "licenses":[
+ {
+ "type":"BSD",
+ "url": "http://github.com/mikeseven/node-image/raw/master/LICENSES"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "git",
+ "url": "https://mikeseven@github.com/mikeseven/node-image.git"
+ }
+ ],
+ "directories": {
+ "src": "src",
+ "lib": "lib",
+ "test": "test"
+ },
+ "engines": {
+ "node": ">=0.5.9"
+ },
+ "scripts": {
+ "install": "rm -rf build; node-waf configure clean build"
+ }
+}
+
Oops, something went wrong.

0 comments on commit f99a2ce

Please sign in to comment.