Sean Barrett
9de22e5a70
Merge branch 'stbiw-png-compr' of https://github.com/DanielGibson/stb
2018-01-29 02:53:25 -08:00
Sean Barrett
b056850ea9
stb_image_write can flip images vertically
2018-01-29 02:52:49 -08:00
John Tullos
841862a622
Fixed grammar, spelling issues in comments
...
issue #533
2018-01-01 18:59:06 -06:00
John Tullos
32a7d5ab68
Added STBI_MSC_SECURE_CRT to support newer MSVC compilers as optional
...
For issue #533
2018-01-01 18:54:26 -06:00
John Tullos
5e844ffe70
Using secure versions of CRT calls to avoid Microsoft Visual C/C++ compiler errors/warnings.
2018-01-01 18:08:30 -06:00
Aarni Koskela
2c7b00ac21
Add force_filter and compression_level parameters to (new) stbi_write_png_to_mem_ex
...
* `force_filter` being < 0 means the original behavior (i.e. figure out
the best-performing filter per scanline); any other values 0 <= x <= 4 correspond
to PNG filters (0 = none, 1 = sub, 2 = up, 3 = average, 4 = Paeth).
* `compression_level` being < 0 equals `compression_level` 8 (the previous value).
The higher this is, the better the compression should be (though it will use
more memory).
These new parameters are not (yet) exposed for the higher-level API functions.
2017-08-07 14:52:53 +03:00
Benji Smith
923c9c3deb
Correct function signature in stbi_write_jpg usage documentation.
2017-07-31 22:22:56 -07:00
Sean Barrett
961923b5a3
fix documentation
2017-07-24 03:32:20 -07:00
Sean Barrett
555efbedfc
Update version numbers
2017-07-23 14:09:39 -07:00
Fabian Giesen
931662ae6e
stb_image_write: Warning fix.
2017-07-22 16:04:07 -07:00
Daniel Gibson
be21113512
stb_image_write.h: Allow setting custom zlib compress function for PNG
...
The builtin stbi_zlib_compress does not compress as well as zlib or
miniz (which is not too surprising as it's <200 LOC), thus PNGs created
by stb_image_write are about 20-50% bigger than PNGs compressed with
libpng.
This change lets the user supply a custom deflate/zlib-style compress
function, which improves compression a lot. This was requested in #113 .
Example for zlib:
#include <zlib.h>
unsigned char* compress_for_stbiw(unsigned char *data, int data_len,
int *out_len, int quality)
{
uLongf bufSize = compressBound(data_len);
// note that buf will be free'd by stb_image_write.h
// with STBIW_FREE() (plain free() by default)
unsigned char* buf = malloc(bufSize);
if(buf == NULL) return NULL;
if(compress2(buf, &bufSize, data, data_len, quality) != Z_OK)
{
free(buf);
return NULL;
}
*out_len = bufSize;
return buf;
}
#define STBIW_ZLIB_COMPRESS compress_for_stbiw
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
// ...
2017-07-04 19:34:31 +02:00
Daniel Gibson
e6bbecd3a9
stb_image_write.h: Set PNG compress lvl via stbi_write_png_level
...
This allows the user to change the deflate/zlib compress level used for
PNG compression by changing a global variable.
2017-07-04 18:07:33 +02:00
Daniel Gibson
f0baa0c287
stb_image_write.h: Fix compilation in C++11 mode
...
clang says:
error: non-constant-expression cannot be narrowed from type 'int'
to 'unsigned char' in initializer list [-Wc++11-narrowing]
so I explicitly cast affected stuff to unsigned char.
2017-07-04 16:55:50 +02:00
Daniel Gibson
e5144a3996
stb_image_write.h: Consistently use STBIWDEF for stbi_write_*
...
Some functions were missing that in the definition, others weren't,
all had it in the declarations.
Added mention of JPG and HDR formats at the top of the file
2017-03-11 18:59:44 +01:00
Daniel Gibson
721c788fdb
stb_image_write: JPEG writer based on jo_jpeg.cpp
...
jo_jpeg.cpp is a Public Domain JPEG writer written by Jon Olick in 2012
http://www.jonolick.com/code.html
My changes to jo_jpeg:
* port to plain C89 (+ // comments, as supported by MSVC6)
* support for 2 comp input (Greyscale+Alpha, Alpha is ignored)
* use stbi__write_context abstraction instead of stdio for writing
* adjust names to stbiw-style
2017-03-11 18:59:44 +01:00
Sean Barrett
47685c5f84
remove deprecated old-precision jpg path from stb_image.h
...
tweak license reference wording
2017-03-03 08:19:09 -08:00
Sean Barrett
51a5368dee
Merge branch 'master' of https://github.com/pboettch/stb into working
2017-03-03 08:02:39 -08:00
Sean Barrett
96620a3a54
update version numbers
2017-01-16 00:51:24 -08:00
Sean Barrett
48710234f2
credits; 1/2/4-bit png fix; easy font spacing; NO_STDIO in image_write
2017-01-15 23:57:53 -08:00
PopPoLoPoPpo
19d03764b5
Fix #ifndef STBI_WRITE_NO_STDIO scioe for stbi_write_hdr()
...
stbi_write_hdr_to_func() should still be available even without STBI_WRITE_NO_STDIO,
just like other formats.
2017-01-03 02:45:16 +01:00
Patrick Boettcher
734576e6be
image-write: fix monochrome bitmap writing from 8-bit-buffers
...
Now writing out monochrome bitmaps from 8-bit arrays works
as it does when using PNG.
Bitmaps need 3 bytes per pixel.
2016-06-15 10:36:39 +02:00
Sean Barrett
6e4154737c
update version numbers, documentation, and contributors
2016-04-02 04:51:26 -07:00
Sean Barrett
097a70ae38
Merge branch 'master' of https://github.com/tulrich/stb
2016-04-02 02:56:39 -07:00
Thatcher Ulrich
291ad22e84
Replace large stack allocations with dynamic allocations.
2016-03-02 15:31:07 -05:00
Craig Donner
ee6978cb68
Slightly modify the public domain license to keep it in the public domain, but make it clear that even when dedications might not be recognized that the code is still usable. Given that this isn't dual-licensing under a different license, I'm hoping this will be acceptable.
2016-02-25 12:55:44 -08:00
Sean Barrett
f1d2002a1d
update contributor list
2016-01-16 10:16:23 -08:00
Sean Barrett
58484eb73d
Merge branch 'implicit_cast_fix' of https://github.com/filipwasil/stb into working
2016-01-16 10:11:54 -08:00
Sean Barrett
9f081b62a4
Merge branch 'stbiw_documentation_typo' of https://github.com/karjonas/stb into working
2016-01-16 10:11:00 -08:00
Sean Barrett
099cd5a279
Merge branch 'msvc_runtime_cast_fixes' of https://github.com/karjonas/stb into working
2016-01-16 10:10:07 -08:00
Sean Barrett
8521c38956
tweak previous crc commit
2016-01-16 10:09:35 -08:00
Sean Barrett
89aaa77b5f
Merge branch 'image_write_parallel' of https://github.com/karjonas/stb into working
2016-01-16 10:04:45 -08:00
Sean Barrett
20aca08f86
Merge branch 'master' of https://github.com/zerhacken/stb into working
2016-01-16 10:02:56 -08:00
Sean Barrett
b9216ddb36
Merge branch 'master' of https://github.com/serge-rgb/stb into working
...
Conflicts:
stb_image_write.h
2016-01-16 10:02:30 -08:00
Sean Barrett
ac748cba9b
update contributor list, version history, version number
2016-01-16 09:57:04 -08:00
Sean Barrett
82ca643ef3
change previous explicitly-sized realloc support to be new API and unbreak old API
2016-01-16 09:47:22 -08:00
Romain Bailly
7e741ffc1e
Added the old size as argument to the STBI_REALLOC() and STBIW_REALLOC() macros
2016-01-14 10:34:30 +01:00
Filip Wasil
8cea0090b2
Removie implicit cast to float
...
When compiling with more restrictive compiler options
such casting from double to float will cause a warning.
Ex. GCC -Wdouble-promotion
Signed-off-by: Filip Wasil <filip.wasil@gmail.com>
2015-10-29 16:09:21 +01:00
Jonas Karlsson
b95858a2f7
Add bitmask to unsigned char casts to fix MSVC runtime checks
2015-10-20 23:22:27 +02:00
Jonas Karlsson
22dd50f256
Fix documentation error
2015-10-20 22:03:50 +02:00
Jonas Karlsson
f1d401845f
Fix race condition in static crc_table
...
If calling stbi_write_png concurrently the static array crc_table would be shared between threads causing data-races.
2015-10-17 17:33:00 +02:00
Rasmus Christian Pedersen
007c850b48
nobug: removed unused variable 'k'
2015-09-25 19:46:27 +02:00
Sergio Gonzalez
b372a1f86c
Avoid macro redefinition in Win32
2015-09-21 12:18:18 -05:00
Sean Barrett
93b2b82996
get rid of unused return value from write callback
2015-09-14 05:57:42 -07:00
Sean Barrett
b4477803cb
fix public function names;
...
fix internal names to be namspaced properly;
2015-09-14 05:48:24 -07:00
Sean Barrett
78fe0bfc24
handle fopen() failing
2015-09-14 05:40:12 -07:00
Sean Barrett
ad63a8d316
Merge branch 'master' of https://github.com/ejulien/stb into working
...
Conflicts:
stb_image_write.h
2015-09-14 05:38:07 -07:00
Sean Barrett
5bcce36638
rle tweaks, credits
2015-09-13 06:58:45 -07:00
Sean Barrett
40ace6b0ef
Merge branch 'master' of https://github.com/fahickman/stb into working
2015-09-13 06:51:14 -07:00
Sean Barrett
a84daa614e
a few more stb_image_write fixes
2015-09-13 06:46:43 -07:00
Sean Barrett
2a1716cc8f
credits
2015-09-13 06:41:16 -07:00
Sean Barrett
23b21a7c1f
Merge branch 'master' of https://github.com/guillaumechereau/stb into working
2015-09-13 06:39:20 -07:00
Sean Barrett
c9859afcf9
reverse some of the public-domain-license changes that I didn't
...
actually want
2015-08-01 23:53:49 -07:00
Ryan Whitworth
45b27d8a9c
Added public domain license text
2015-08-01 14:54:05 -04:00
fahickman
80a0e90d53
TGA RLE flag and regression fix
...
Add requested flag for controlling TGA RLE compression and fix a
regression when writing monochrome TGAs.
2015-07-03 14:27:29 -07:00
fahickman
126ec22867
add missing consts
2015-06-04 14:04:02 -07:00
fahickman
e0e4bd4d86
write TGAs with RLE compression
2015-05-11 21:38:55 -07:00
Guillaume Chereau
d1d5f4ca96
add STB_IMAGE_WRITE_STATIC macro
...
This is the same thing than STB_IMAGE_STATIC of stb_image.h.
2015-04-20 23:18:42 +08:00
Guillaume Chereau
347e7838be
fix compilation of stb_image_write.h with gcc -O3
...
When compiling with -O3, gcc would complain that 'linear' might not be
initialized if comp is superior to 4.
In fact passing a value > 4 is an error anyway, but gcc does not know
that. I changed the switch case to support comp > 4. I don't think it
should affect the performances.
2015-04-20 22:59:24 +08:00
Sean Barrett
00b1797a23
switch memcpy to memmove for simplicity;
...
rename all STBI_ config macros to STBIW_ to avoid conflict with stb_image.h
2015-04-13 11:55:24 -07:00
Sean Barrett
019236a624
Merge branch 'stb-image-writer-memory' of https://github.com/callidus/stb into work2
2015-04-13 11:48:26 -07:00
Tim Kelsey
8b1d835e16
Adding memory and assert defines to stb_image_write
2015-04-08 15:24:46 +01:00
Jørgen P. Tjernø
80176ae4a1
Remove unused variables in write_hdr_scanline.
...
Fixes #90 .
2015-03-24 11:22:20 -07:00
Sean Barrett
22fa9a467a
rewrite HDR rle logic
2015-01-18 10:43:42 -08:00
Sean Barrett
80d5c4be48
fix bug introduced when doing hdr cleanup
2015-01-17 09:16:48 -08:00
Sean Barrett
d91cbdf662
Merge branch 'test'
2015-01-17 07:47:52 -08:00
Sean Barrett
edd5e6700d
tweak baldurk's hdr implementation
2015-01-17 07:46:22 -08:00
Sean Barrett
6639ef6d5a
fix monochrome bmp support
2015-01-17 07:15:50 -08:00
Emmanuel Julien
529d8163b2
Add support for writing through callback functions in stb_image_write.h.
2015-01-13 17:43:14 +01:00
baldurk
fb8eabd6b8
Add .hdr file writing support
2014-09-09 08:33:25 +01:00
Sean Barrett
492e3f3463
update version numbers
2014-08-17 21:12:16 -07:00
Sean Barrett
7e079c670d
tweak TGA monochrome support
2014-08-16 13:52:47 -07:00
Jean-Sbastien Guay
ebc2d23d47
realized the 2 colorbytes case is impossible.
...
also updated the comment at the top of the file to reflect stbi_write_tga's new capabilities.
2014-08-09 09:16:57 -04:00
Jean-Sbastien Guay
26a71f67fe
comment was wrong way around... code was right.
2014-08-09 01:08:43 -04:00
Jean-Sbastien Guay
b8b364c301
stbi_write_tga can now write 1 and 2 channel (grayscale and grayscale-alpha) images.
2014-08-09 00:34:49 -04:00
Sean Barrett
b96edc012c
Merge branch 'headerify'
...
Conflicts:
tests/stretch_test.dsp
2014-06-03 08:51:40 -07:00
Sean Barrett
ca093eda56
add strict-aliasing warnings; update readme to include stretchy_buffer
2014-06-01 08:04:07 -07:00
Sean Barrett
7add5044e0
bump version number
2014-05-31 06:27:09 -07:00
Sean Barrett
9f251b6da1
rename stb_image_write private functions to use stbiw__ not stbi__ to avoid conflict with stb_image.h
2014-05-31 06:25:31 -07:00
Sean Barrett
fcfcb9bb3f
generate README.md in part by parsing libraries so that version numbers are in sync
2014-05-30 14:15:51 -07:00
Sean Barrett
70df4966f0
various warning fixes, STBI_SIMD compile error, incorrect file-pointer state for one API
2014-05-27 12:14:26 -07:00
Sean Barrett
e2caccb811
initial checkin
2014-05-25 10:18:03 -07:00