On Jul 4, 2021, at 3:38 PM, 'Kevin McBride' via libjpeg-turbo
User Discussion/Support <libjpeg-t...@googlegroups.com> wrote:
I found the problem in my code. I was not correctly converting
the image data into a single dimension unsigned char array. I
changed the code to the following, and I managed to get the
PNG-style array converted into the array that TurboJPEG accepts.
I also corrected the pitch.
srcbuf2 = srcbuf = (unsigned char *)calloc(x, y);
if ( srcbuf == NULL )
return 0;
/* Fill the jpeg buffer. */
for ( i=0; i < y; i++ )
{
memcpy(srcbuf2, image[i], x);
srcbuf2 += x;
}
Now the image comes out looking the same as the PNG. First image
is the JPEG, second image is the PNG.
<output00001.jpeg>
<output00001.png>
Thank you for the help, DRC.
On Sunday, July 4, 2021 at 3:45:49 PM UTC-4 Kevin McBride wrote:
I changed the call to tcCompress2 to the following and still
do not get the expected result:
tjCompress2(
jpeghandle,
srcbuf,
x,
x * tjPixelSize[TJPF_GRAY],
y,
TJPF_GRAY,
&jpegBuf,
&jpegSize,
TJSAMP_GRAY,
100,
TJFLAG_STOPONWARNING)
output00001.jpeg
On Sunday, July 4, 2021 at 9:51:08 AM UTC-4 DRC wrote:
At first glance, it appears as if you are setting the
pitch argument incorrectly. Should that not be x * 1
rather than y * 1?
On Jul 3, 2021, at 8:48 PM, 'Kevin McBride' via
libjpeg-turbo User Discussion/Support
<libjpeg-t...@googlegroups.com> wrote:
Good evening,
I am working on my project stick2xyz
http://sourceforge.net/projects/stick2xyz
<http://sourceforge.net/projects/stick2xyz>
and I have an image that is mirroring itself after the
source buffer has been passed to tjCompress2 with the
following args:
tjCompress2(
jpeghandle,
srcbuf,
x, // x is 320
y * 1,
y, // y is 240
TJPF_GRAY,
&jpegBuf,
&jpegSize,
TJSAMP_GRAY,
100,
TJFLAG_STOPONWARNING)
I am using version 2.0.90 from Fedora. Attached is the
memory dump of srcbuf in hex as well as the output jpeg
I got.
I do not want the image data duplicated to the right of
the image while in tjCompress2.
<output00001.jpeg>
--
You received this message because you are subscribed to
the Google Groups "libjpeg-turbo User
Discussion/Support" group.
To unsubscribe from this group and stop receiving emails
from it, send an email to
libjpeg-turbo-u...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/libjpeg-turbo-users/ba7a1531-7b23-4631-b084-1c890d432de2n%40googlegroups.com
<https://groups.google.com/d/msgid/libjpeg-turbo-users/ba7a1531-7b23-4631-b084-1c890d432de2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
<test.txt>
<output00001.jpeg>
--
You received this message because you are subscribed to the
Google Groups "libjpeg-turbo User Discussion/Support" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to libjpeg-turbo-u...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/libjpeg-turbo-users/7a60d672-f2cf-438c-bb83-4b45cd08ff58n%40googlegroups.com
<https://groups.google.com/d/msgid/libjpeg-turbo-users/7a60d672-f2cf-438c-bb83-4b45cd08ff58n%40googlegroups.com?utm_medium=email&utm_source=footer>.
<output00001.jpeg>
<output00001.png>