ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  CMDL <*img*> in addText
Posted by Wontae on Oct-12-2022 16:47
Attachments:
Hello Peter

I use ChartDirector 6.3

in my case
i use addText funtion for fill background

Ex)
pBaseChart.addText(0, 0, "<*img=C:/test/test.jpg,width=523,height=316*>").setZOrder(Chart.ChartBackZ);
...
...
(so many another work)
...
...
xyChart.getDrawArea().outSVG(svgOutputStream, "noxmldecl;nodoctype;");

another image format is not problem.
but jpg format has something problem.
(please refer attachment image)

jpg format to svg
base image's width and height is exchange

could you check this problem?



I'm really sorry if it's my mistake.
png_test.png
gif_test.png
jpg_test.png
png_svg.png
jpg_svg.png

  Re: CMDL <*img*> in addText
Posted by Peter Kwan on Oct-12-2022 21:21
Hi Wontae,

Would you mind to attach the original JPG image as a file, so I can test it?

Without seeing the actual JPG, my guess is that the JPG has a camera flag that indicates it should be rotated.

For JPG/PNG/GIF, traditionally, the width and height refers to the width and height of the actual pixel image.

However, for JPG, nowadays people often create JPG by taking pictures with a smart phone. The user may hold the smart phone in a rotated position (held the phone vertically). So for those JPG, there is a camera flag that indicates how the user held the camera when taking the photo.

In the past, the camera flag is usually ignored except for photo processing applications. In newer versions of Windows, if the camera flag is rotated, it will also display the JPG image as rotated. However, due to backwards compatibility issues, ChartDirector still uses the actual pixel size.

For your case, my guess is that the JPG image is actually 119 x 128 in size, with a camera flag sets as holding the camera rotated. So in ChartDirector, it displays as 119 x 128. However, in Windows, it may display as 128 x 119.

To confirm if this is the real cause of the issue, you may provide me with the original JPG for analysis.

Best Regards
Peter Kwan

  Re: CMDL <*img*> in addText
Posted by Wontae on Oct-13-2022 09:20
Attachments:
Thank you for your quick reply

I attach my test image file

I used paint.exe for test
just change save format.

first image is jpg format
second is png format


I'm still not exactly sure.
These two image show a difference when I test them.

I hope there will be a meaningful result.

Thank you
backGround.jpg
_backGround.png
backGround.jpg
backGround.png

  Re: CMDL <*img*> in addText
Posted by Peter Kwan on Oct-14-2022 03:25
Attachments:
Hi Wontae,

I have just tried myself with your JPEG filie using ChartDirector for .NET 6.3. It works normally in my case. The JPEG is read as 128 x 119 pixels, and it correctly fills the chart background.

I have attached my test code "svgtest.aspx" (it is an ASP.NET web page), the image I use "background2.jpg" (which is from your post), and the resulting SVG (svgtest.svg).

May be you can try the code I attached to see if it works in your machine.

Note that I added a line to set the TextBox margin to 0 to ensure it fills the entire background:

ChartDirector.TextBox t = c.addText(0, 0, "<*img=background2.jpg,width=526,height=313*>");
t.setZOrder(Chart.ChartBackZ);
t.setMargin(0);

To SVG is included in the web page by using an <IMG> tag.

I also studied your last post in more detail. I found that even if the image is detected as 119 x 128, it should still fill the background bacause the scale factor (<g transform="scale(4.42017,2.44531)">) should still resize the image to fill the chart.

For your case, is the SVG displayed in a web page? How is the SVG included in the web page? Is it using an <IMG> tag, or is it by directly inserting the SVG tags into the HTML? If you insert the SVG into the HTML, the HTML style sheet may also affect the image inside the SVG.

If the above still cannot solve the problem, is it possible to provide a simple example that I can try (may be you can modify my svgtest.aspx to illustrate how to reproduce the problem)?

Regards
Peter Kwan
backGround2.jpg
backGround2.jpg

2.42 Kb
svgtest.svg
svgtest.svg

4.20 Kb
svgtest.aspx
svgtest.aspx

811 bytes

  Re: CMDL <*img*> in addText
Posted by Wontae on Oct-14-2022 16:44
Attachments:
Hi Peter

I'm so sorry, i for writen about my environment.

now i use Java
so i can't check your testcode

- the SVG image use in web page
- use <SVG> tag  ** attach image


i try your jpg image and another image( pixabay.com free image)
download jpg image  change png format ( i use paint.exe, just 'save as' format change)

in my computer,
jpg is wrong, png is perfect


colud you please check  outSvg method in Java?

Regards
Wontae

<attach image>
1. svg tag  and css
2. img in svg tag and css
3. pixabay free jpg image
-  i want attach pixabay free jpg image convert to png image but file size is over
4. outSvg about jpg image
5. outSvg about png image
html_svg.png
html_img.png
backGround.jpg
test_horse_jpg.jpg
test_horse_png.png

  Re: CMDL <*img*> in addText
Posted by Peter Kwan on Oct-15-2022 01:20
Hi Wontae,

Sorry for my misunderstanding of your programming language. I retested using ChartDirector for Java and can reproduce your issue. I confirm this is a bug in ChartDirector.

I have created an updated ChartDirector.jar that can fix this problem. You may download it from:

https://www.advsofteng.com/support/cdjava701p1.zip

Note that the above is based on ChartDirector 7, which should be code compatible with ChartDirector 6. If your license was purchased on or after Jun 15, 2015, it should be work with ChartDirector 7 too. If your license was purchased earlier, please contact me by email pkwan@advsofteng.net .

Best Regards
Peter Kwan