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

Message ListMessage List     Post MessagePost Message

  JPEG images DrawArea.Resize problems
Posted by Vasile Dosca on Aug-29-2022 17:01
Good morning !
I use ChatrtDirector long time ,

One of methods used in my application is simple Resize.

After upgrade version to 7 my application has selective action,

Filse is made by various Android or iOS or other tools from production,
application have to show small image as tumbnails case bay case.


Could you please help me to uderstand what I do so incorrect.
That is mainly what do my code.

ImageName = ServRs.Fields("FileName").Value
DateTimeCreated = ServRs.Fields("DateTimeCreated").Value
CloseServDataBase

ImageType = "." & Right(ImageName, Len(ImageName) - InStrRev(ImageName, "."))
If InStr(1,ImageTypes,LCase(ImageType))=0 Then
    Send "Wrong type [" & ImageType & "], expected one of [" & ImageTypes & "]. "
Exit Sub
End if
ImagePathVirt = "/OperatorTools/Public-Expedition-Photo-Files/Year-" & Year(DateTimeCreated)
ImagePathAbs = Server.MapPath(ImagePathVirt) & "" & ImageName

SET FSO = CreateObject("Scripting.FileSystemObject")

If FSO.FileExists(ImagePathAbs)=False Then
    Send "Image [" & ImageName & "] not found"
Exit Sub
End If
Set cd = CreateObject("ChartDirector.API")
Set da = cd.DrawArea()
Call da.LoadJPG(ImagePathAbs)
WidthOld  = da.getWidth
HeightOld = da.getHeight
K = WidthOld/MaxWidthIn   'MaxWith=100
WidthNew  = CInt(WidthOld/K)
HeightNew = CInt(HeightOld/K)
Call da.Resize(WidthNew,HeightNew,1,1)
Response.ContentType = "image/jpg"
Response.BinaryWrite da.outJPG2()
Response.End
Set da = nothing
Set cd = nothing


With hops and thank!

Vasile Dosca

  Re: JPEG images DrawArea.Resize problems
Posted by Peter Kwan on Aug-30-2022 18:17
Hi Vasile,

For testing, I tried the following code that resizes the image "c:temptest.jpg". I tried several different images for test.jpg, and it works normally.

<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")
Set da = cd.DrawArea()
Call da.LoadJPG("c:temptest.jpg")
WidthOld  = da.getWidth
HeightOld = da.getHeight
MaxwidthIn = 100
K = WidthOld/MaxWidthIn   'MaxWith=100
WidthNew  = CInt(WidthOld/K)
HeightNew = CInt(HeightOld/K)
Call da.Resize(WidthNew,HeightNew,1,1)
Response.ContentType = "image/jpg"
Response.BinaryWrite da.outJPG2()
Response.End
%>


Is it possible to provide an image that can cause the resize to work incorrectly? If we can have an image that can reproduce the problem, it would be enough for us to fix the problem. It would be most helpful if you can also provide a screenshot so we can see what is the incorrect output when viewed in your computer.

We are aware of a bug in ChartDirector when resizing the image up (that is, increasing the image size). When the image is sized up, there are more pixels, and it may have some noise in those pixels. We are not aware of any issue if the image is sized down.

Best Regards
Peter Kwan

  Re: JPEG images DrawArea.Resize problems
Posted by Peter Kwan on Sep-01-2022 04:32
Hi Vasile,

Thanks for providing some sample files to allow us to reproduce the problem.

We confirm the problem is due to a bug introduced in ChartDirector 7. The bug can be triggered by certain images created with Samsung Android smart phones.

To solve the problem, please use the following patched ChartDirector DLL "chartdir70.dll".

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

For ChartDirector for ASP/COM/VB, the "chartdir70.dll" is by default installed into "c:Program Files (x86)ChartDirectorlib", but you can also choose another directory during installation. Please replace the "chartdir70.dll" with the one in the downloaded patch.

If you are using ChartDirector in an ASP application, you may be unable to replace the DLL while IIS is running. You can stop the IIS by opening an Admin command prompt, and then enter "net stop w3svc". After that, you can replace the DLL. You can then restart IIS by using "net start w3svc".

Best Regards
Peter Kwan