473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

imageline and extra contiguous pixels

Hello!

I'm using PHP Version 4.3.3RC5-dev with GD Version bundled (2.0.15
compatible) to generated some graphics based on mysql data and to my
surprise when I use the GD function imageline($im, $x1, $y1, $x2, $y2,
$cl); (with $cl being the collorallocated via function) the line is
draw dirtying the contiguous pixels of the image ($im), making some
extra pixels around the background. I've removed my jpeg background
and the problem remains. It's something like when we zoom in too much
and got some block
pixels with "random" colors. I don't know what to do. If someone want
to help me I can send two little .jpg (each 20kb) showing the problem.
I'm wondering to use only 16 colors pics (I don't know how to create
it with only 16 colors (4bits?)) to see if I can "fool" the imageline
to avoid extra dirty pixels... help me please!

Thank you for your attention
Jul 17 '05 #1
4 2332

"baruch" <sp***@terra.com.br> wrote in message
news:3a*************************@posting.google.co m...
Hello!

I'm using PHP Version 4.3.3RC5-dev with GD Version bundled (2.0.15
compatible) to generated some graphics based on mysql data and to my
surprise when I use the GD function imageline($im, $x1, $y1, $x2, $y2,
$cl); (with $cl being the collorallocated via function) the line is
draw dirtying the contiguous pixels of the image ($im), making some
extra pixels around the background. I've removed my jpeg background
and the problem remains. It's something like when we zoom in too much
and got some block
pixels with "random" colors. I don't know what to do. If someone want
to help me I can send two little .jpg (each 20kb) showing the problem.
I'm wondering to use only 16 colors pics (I don't know how to create
it with only 16 colors (4bits?)) to see if I can "fool" the imageline
to avoid extra dirty pixels... help me please!

Thank you for your attention


Code, code, code, code, code. Make a test application that demonstrates the
same problem with minimal code and post it so we can try it ourselves.

Garp
Jul 17 '05 #2
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message news:<gK*********************@news-text.cableinet.net>...
"baruch" <sp***@terra.com.br> wrote in message
news:3a*************************@posting.google.co m...
Hello!

I'm using PHP Version 4.3.3RC5-dev with GD Version bundled (2.0.15
compatible) to generated some graphics based on mysql data and to my
surprise when I use the GD function imageline($im, $x1, $y1, $x2, $y2,
$cl); (with $cl being the collorallocated via function) the line is
draw dirtying the contiguous pixels of the image ($im), making some
extra pixels around the background. I've removed my jpeg background
and the problem remains. It's something like when we zoom in too much
and got some block
pixels with "random" colors. I don't know what to do. If someone want
to help me I can send two little .jpg (each 20kb) showing the problem.
I'm wondering to use only 16 colors pics (I don't know how to create
it with only 16 colors (4bits?)) to see if I can "fool" the imageline
to avoid extra dirty pixels... help me please!

Thank you for your attention


Code, code, code, code, code. Make a test application that demonstrates the
same problem with minimal code and post it so we can try it ourselves.

Garp


// just testing without loading the .jpeg
// $im = imagecreatefromjpeg("imagens/a4escala.jpg");

$im = imagecreatetruecolor(750, 650);
if (!$im) { die("error..."); }

$c = imagecolorallocate ($im, 255, 255, 255);
imagefilledrectangle ($im, 0, 0, 750, 650, $c);

// [...] here the data is loaded from a sql query;
// some color allocation...
$cl= imagecolorallocate ($im, 0, 0, 255); // azul
header("Content-type: image/jpeg");
// for {
// more some calcs and loops to generated 5 up to 7 lines (array of points)
imageline($im, $x1, $y1, $x2, $y2, $cl);
// }
$arq = "relatorios/g-001001SP-".$f_id.".jpg";
imagejpeg($im, $arq);
imagejpeg($im);
imagedestroy($im);
deleta_rel_tmp();
unset($a_x, $a_y, $a_v);
Jul 17 '05 #3

"baruch" <sp***@terra.com.br> wrote in message
news:3a**************************@posting.google.c om...
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message news:<gK*********************@news-text.cableinet.net>...
"baruch" <sp***@terra.com.br> wrote in message
news:3a*************************@posting.google.co m...
Hello!

I'm using PHP Version 4.3.3RC5-dev with GD Version bundled (2.0.15
compatible) to generated some graphics based on mysql data and to my
surprise when I use the GD function imageline($im, $x1, $y1, $x2, $y2,
$cl); (with $cl being the collorallocated via function) the line is
draw dirtying the contiguous pixels of the image ($im), making some
extra pixels around the background. I've removed my jpeg background
and the problem remains. It's something like when we zoom in too much
and got some block
pixels with "random" colors. I don't know what to do. If someone want
to help me I can send two little .jpg (each 20kb) showing the problem.
I'm wondering to use only 16 colors pics (I don't know how to create
it with only 16 colors (4bits?)) to see if I can "fool" the imageline
to avoid extra dirty pixels... help me please!

Thank you for your attention


Code, code, code, code, code. Make a test application that demonstrates the same problem with minimal code and post it so we can try it ourselves.

Garp


// just testing without loading the .jpeg
// $im = imagecreatefromjpeg("imagens/a4escala.jpg");

$im = imagecreatetruecolor(750, 650);
if (!$im) { die("error..."); }

$c = imagecolorallocate ($im, 255, 255, 255);
imagefilledrectangle ($im, 0, 0, 750, 650, $c);

// [...] here the data is loaded from a sql query;
// some color allocation...
$cl= imagecolorallocate ($im, 0, 0, 255); // azul
header("Content-type: image/jpeg");
// for {
// more some calcs and loops to generated 5 up to 7 lines (array of

points) imageline($im, $x1, $y1, $x2, $y2, $cl);
// }
$arq = "relatorios/g-001001SP-".$f_id.".jpg";
imagejpeg($im, $arq);
imagejpeg($im);
imagedestroy($im);
deleta_rel_tmp();
unset($a_x, $a_y, $a_v);


Still having this? I tried this code and it's not really showing it (least
of all, $x1, $y1 etc are all undefined so I'm filling in bogus values). Feel
like posting URLs to the Jpegs?

Garp
Jul 17 '05 #4
"baruch" <sp***@terra.com.br> wrote in message
news:3a**************************@posting.google.c om...
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message news:<gK*********************@news-text.cableinet.net>...
"baruch" <sp***@terra.com.br> wrote in message
news:3a*************************@posting.google.co m...
Hello!

I'm using PHP Version 4.3.3RC5-dev with GD Version bundled (2.0.15
compatible) to generated some graphics based on mysql data and to my
surprise when I use the GD function imageline($im, $x1, $y1, $x2, $y2,
$cl); (with $cl being the collorallocated via function) the line is
draw dirtying the contiguous pixels of the image ($im), making some
extra pixels around the background. I've removed my jpeg background
and the problem remains. It's something like when we zoom in too much
and got some block
pixels with "random" colors. I don't know what to do. If someone want
to help me I can send two little .jpg (each 20kb) showing the problem.
I'm wondering to use only 16 colors pics (I don't know how to create
it with only 16 colors (4bits?)) to see if I can "fool" the imageline
to avoid extra dirty pixels... help me please!

Thank you for your attention


Code, code, code, code, code. Make a test application that demonstrates the same problem with minimal code and post it so we can try it ourselves.

Garp


// just testing without loading the .jpeg
// $im = imagecreatefromjpeg("imagens/a4escala.jpg");

$im = imagecreatetruecolor(750, 650);
if (!$im) { die("error..."); }

$c = imagecolorallocate ($im, 255, 255, 255);
imagefilledrectangle ($im, 0, 0, 750, 650, $c);

// [...] here the data is loaded from a sql query;
// some color allocation...
$cl= imagecolorallocate ($im, 0, 0, 255); // azul
header("Content-type: image/jpeg");
// for {
// more some calcs and loops to generated 5 up to 7 lines (array of

points) imageline($im, $x1, $y1, $x2, $y2, $cl);
// }
$arq = "relatorios/g-001001SP-".$f_id.".jpg";
imagejpeg($im, $arq);
imagejpeg($im);
imagedestroy($im);
deleta_rel_tmp();
unset($a_x, $a_y, $a_v);


If you change 'imagejpeg($im);' to 'imagejpeg($im,"",100) the problem may
go away. This is the quality of the image from 0 to 100 with 100 being the
best. The only other thing to do is use 'imagepng' instead (or gif if you
install it). The problem simply is the jpeg compression causes artifacts
with solid colors and/or sharp edges.

p.s. make sure you include the double quotes "" as you can't specify the
quality without them.

Norm
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bill | last post by:
Hi How to get rid of the extra line added after a <ul> in a <div> ? <li> are defined as inline and the total text lenght is about 30% of the available line width. Thanks
9
by: Olumide | last post by:
Thats the question. I know about virtual memory, and the MMU. I just wonder if array members guaranteed to be contiguous in physical memory (and if so, why). Thanks, Olumide
5
by: Stefan Krah | last post by:
Hello, I am currently writing code where it is convenient to convert char to int . The conversion function relies on a character set with contiguous alphabets. int set_mesg(Key *key, char...
38
by: Peteroid | last post by:
I looked at the addresses in an 'array<>' during debug and noticed that the addresses were contiguous. Is this guaranteed, or just something it does if it can? PS = VS C++.NET 2005 Express...
22
by: divya_rathore_ | last post by:
No pun intended in the subject :) Is dynamically allocated memory contiguous in C++? In C? Deails would be appreciated. warm regards, Divya Rathore (remove underscores for email ID)
22
by: Jack | last post by:
The following code can be compiled. But When I run it, it causes "Segmentation fault". int main(){ char **c1; *c1 = "HOW"; // LINE1 ++(*c1); *c1 = "ARE";
9
by: jmcgill | last post by:
Saw this used as an example. Compiles without warnings. "Works." Kosher or not? Why or why not? #include <stdio.h> int main(int argc, char **argv){ int i,j,k,l,m; int *p; i=2; j=4; k=8;...
2
by: lonni4000 | last post by:
My parser parses special characters okay, but adds extra line breaks. It makes no sense to me at all! If anyone knows what I am doing wrong, please help. text file: <?xml version="1.0"...
3
by: Rich.Hephner | last post by:
Hi, I'm new to this group, but in need of some help with a css based two column layout. The layout consists of a short left nav and a content section. The problem is that in IE, the content...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.