Discussion:
Convert Picture Crashing 4D
Sannyasin Siddhanathaswami
2017-02-06 22:02:07 UTC
Permalink
Aloha,

We are starting the preparations for v16, and dealing with the picture issues. Let’s just say we have tons of ancient photos in our database! We are currently using v15.3 on a Mac (server - client).

Basically, we are trying to convert all pictures to jpg. Unfortunately, doing this crashed 4D:
CONVERT PICTURE([Members]Picture;".jpg";0.8)

Even putting the picture field into a variable before converting crashes during the “Convert Picture.” It’s not all picture, just many of them. By crash, the 4D.app just quits to the desktop with a crash report.

I can view these pictures just fine in an input form. If I copy the picture out of the input form, into another app, then back in, the conversion works fine.

Anyone have any tips on how to approach this? If I run the method to execute on server, the whole server crashes…

Thanks,


Sannyasin Siddhanathaswami
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
******************************************************************
Keisuke Miyako
2017-02-06 23:16:50 UTC
Permalink
sounds like the header of the JPEG (or maybe it's QuickTime, who knows...) has a bad offset value.

are you using a 32-bit version of 4D?
is QuickTime activated?
does it really have to be JPEG (as opposed to, say, PNG)?
do you really need to apply compression?

why not call GET PICTURE FORMATS before you apply the conversion on the suspicious picture?
http://doc.4d.com/4Dv16/4D/16/GET-PICTURE-FORMATS.301-2925150.en.html

2017/02/07 7:02、Sannyasin Siddhanathaswami <***@hindu.org<mailto:***@hindu.org>> のメール:
I can view these pictures just fine in an input form. If I copy the picture out of the input form, into another app, then back in, the conversion works fine.
Anyone have any tips on how to approach this? If I run the method to execute on server, the whole server crashes…


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*******************************
Keisuke Miyako
2017-02-06 23:22:49 UTC
Permalink
if the picture contains multiple formats,
including the format you specified,
the command simply uses the existing copy.

to really force a conversion, you might want to avoid JPEG

2017/02/07 7:02、Sannyasin Siddhanathaswami <***@hindu.org<mailto:***@hindu.org>> のメール:
CONVERT PICTURE([Members]Picture;".jpg";0.8)



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*************************************************
Charles Miller
2017-02-07 01:03:58 UTC
Permalink
We have found many problems with running convert many pictures using v15.x (1,2,and 3).

Make sure as others have said that
1. Quick time enabled on server
2. Quick time installed-
3. check to see if picture compressed and if so uncompress first
4 Run on client not server.
5. Also I would not go to PNG, we have found that when converting to PNG pictures get huge, what was 1.2 meg as a pict in 4D can become 20 meg as a png

6. Another option is to print to pdf and then use acrobat professional or some other tool to convert to jpeg and any other format of you choice. Doing this means you will have to name files and then re-import same

7. You might also try write picture file and then read it and convert form there

FYI we have over 500,000 pictures that we had to convert

Regards

Chuck
------------------------------------------------------------------------------------------------
Chuck Miller Voice: (617) 739-0306
Informed Solutions, Inc. Fax: (617) 232-1064
mailto:miller.cjay<AT SIGN>gmail.com <http://gmail.com/>
Brookline, MA 02446 USA Registered 4D Developer
Providers of 4D and Sybase connectivity
http://www.informed-solutions.com
------------------------------------------------------------------------------------------------
Post by Keisuke Miyako
if the picture contains multiple formats,
including the format you specified,
the command simply uses the existing copy.
to really force a conversion, you might want to avoid JPEG
CONVERT PICTURE([Members]Picture;".jpg";0.8)
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
**********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*******************************************************
Keisuke Miyako
2017-02-07 01:10:35 UTC
Permalink
this really depends on the nature of the picture.

PNG compresses bitmap without losing any information.

JPEG is a more heuristic kind of algorithm for natural photos,
where similar colours blend into each other
but contrasting colours can create ugly pixels on the edges.

2017/02/07 10:03、Charles Miller <***@gmail.com<mailto:***@gmail.com>> のメール:
5. Also I would not go to PNG, we have found that when converting to PNG pictures get huge, what was 1.2 meg as a pict in 4D can become 20 meg as a png



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
********************
Chuck Miller
2017-02-07 15:05:16 UTC
Permalink
I agree in principle, but inside 4D when pictures are drawings saved as picts results can be off the charts form a size standpoint. I have tried converting some of these outside of 4D with same results, so I am just saying be careful

If desired, I can email you off list a few of these picts so you can test for yourself

Regards

------------------------------------------------------------------------------------------------
Chuck Miller Voice: (617) 739-0306
Informed Solutions, Inc. Fax: (617) 232-1064
mailto:cjmiller<AT SIGN>informed-solutions.com
Brookline, MA 02446 USA Registered 4D Developer
Providers of 4D and Sybase connectivity
http://www.informed-solutions.com
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law. These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited. Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication.
Post by Keisuke Miyako
this really depends on the nature of the picture.
PNG compresses bitmap without losing any information.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
***********************
Nigel Greenlee
2017-02-07 09:36:07 UTC
Permalink
Sannyasin

Hi-if you having trouble with 4D crashing it you might consider exporting the picture in the what ever format it currently is and then using LEP to call the command line to convert it to a JPG, then you can re-import the new picture.

https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html <https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html>

Nigel Greenlee
Post by Sannyasin Siddhanathaswami
Aloha,
We are starting the preparations for v16, and dealing with the picture issues. Let’s just say we have tons of ancient photos in our database! We are currently using v15.3 on a Mac (server - client).
CONVERT PICTURE([Members]Picture;".jpg";0.8)
Even putting the picture field into a variable before converting crashes during the “Convert Picture.” It’s not all picture, just many of them. By crash, the 4D.app just quits to the desktop with a crash report.
I can view these pictures just fine in an input form. If I copy the picture out of the input form, into another app, then back in, the conversion works fine.
Anyone have any tips on how to approach this? If I run the method to execute on server, the whole server crashes…
Thanks,
Sannyasin Siddhanathaswami
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
**********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*************************************
Nigel Greenlee
2017-02-07 10:41:11 UTC
Permalink
Sannyasin

Sorry i should have been more explanatory there..something like this(this all assumes the picture does load in the record)

$Path:=System folder(Documents folder)
$Path:=$Path+"Pictures"
If (Test path name($Path)#Is a folder)
CREATE FOLDER($Path)
End if
$OutPath:=$path+Folder separator+"Converted_Pictures"
If (Test path name($OutPath)#Is a folder)
CREATE FOLDER($OutPath)
End if
$OutPath:=$OutPath+Folder separator
ALL RECORDS([TABLE])
PICTURE CODEC LIST($Codecs;$Names)

For ($i;1;Records in selection([TABLE]))
If (Picture size([TABLE]Picture_pic)>0)
$_t_DocName:=[TABLE]RECORDIDSTRING

PICTURE TO BLOB([TABLE]Picture_pic;$_aPicBlob;".jpg”)<-if this does not work try something else
$doc:=Create document($Path+Folder separator+$_t_DocName+".jpg")
CLOSE DOCUMENT($doc)
BLOB TO DOCUMENT($Path+Folder separator+$_t_DocName+".jpg";$_aPicBlob)
$PosixPath:=Convert path system to POSIX($Path+Folder separator+$_t_DocName+".jpg")
$OutPosixPath:=Convert path system to POSIX($OutPath+$_t_DocName+".png")
$_t_Script:="sips -s format png "+$PosixPath+" --out "+$OutPosixPath
LAUNCH EXTERNAL PROCESS($_t_Script)
end if
//here you would get the image from the new document back into the record if that is what you are planning to do
NEXT RECORD([TABLE])

End for

I cant say if that will be any better-but if this will convert the picture(or even just export it in JPEG format) then you can open the image in preview and if it is loading there can then bring the JPEG back into the record.
Post by Sannyasin Siddhanathaswami
Sannyasin
Hi-if you having trouble with 4D crashing it you might consider exporting the picture in the what ever format it currently is and then using LEP to call the command line to convert it to a JPG, then you can re-import the new picture.
https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html <https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html>
Nigel Greenlee
Post by Sannyasin Siddhanathaswami
Aloha,
We are starting the preparations for v16, and dealing with the picture issues. Let’s just say we have tons of ancient photos in our database! We are currently using v15.3 on a Mac (server - client).
CONVERT PICTURE([Members]Picture;".jpg";0.8)
Even putting the picture field into a variable before converting crashes during the “Convert Picture.” It’s not all picture, just many of them. By crash, the 4D.app just quits to the desktop with a crash report.
I can view these pictures just fine in an input form. If I copy the picture out of the input form, into another app, then back in, the conversion works fine.
Anyone have any tips on how to approach this? If I run the method to execute on server, the whole server crashes…
Thanks,
Sannyasin Siddhanathaswami
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
**********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
**********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*********************************
Sannyasin Siddhanathaswami
2017-02-09 02:14:12 UTC
Permalink
Aloha,

Thanks Nigel, and all. Even exporting the picture also causes a crash on some of the pictures.

I’ll do some more testing.

In answer to Charles’s questions, both server and client are on a Mac, so quicktime is installed by default. I don’t see how to determine if a picture is compressed.

I’ll try these things next:
Convert to PNG. If that works, convert again to JPG
Try PICTURE to BLOB, then BLOB to PICTURE instead of CONVERT PICTURE
Try the obsolete " _o_QT COMPRESS PICTURE”

I’ll let you all know what works for these funky pictures.


Sannyasin Siddhanathaswami


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
********************************************************************
Nigel Greenlee
2017-02-09 09:03:03 UTC
Permalink
Sannyasin

Did you try

SET PICTURE TO PASTEBOARD ? with the crashing pictures. If that does not crash that might give you an option(get clipboard data..etc etc....if it does i think if you can’t then resolve it using Brunos' picture analysis code you will need to kiss them records goodbye.

Good luck.

Nigel
Post by Sannyasin Siddhanathaswami
Aloha,
Thanks Nigel, and all. Even exporting the picture also causes a crash on some of the pictures.
I’ll do some more testing.
In answer to Charles’s questions, both server and client are on a Mac, so quicktime is installed by default. I don’t see how to determine if a picture is compressed.
Convert to PNG. If that works, convert again to JPG
Try PICTURE to BLOB, then BLOB to PICTURE instead of CONVERT PICTURE
Try the obsolete " _o_QT COMPRESS PICTURE”
I’ll let you all know what works for these funky pictures.
Sannyasin Siddhanathaswami
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
**********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*****************
Chuck Miller
2017-02-10 03:21:35 UTC
Permalink
Also create 2 forms one vertical one horizontal Get pict eight and width put into pict variablle print form too pdf with some identifiable name
Regards

Chuck
------------------------------------------------------------------------------------------------
Chuck Miller Voice: (617) 739-0306
Informed Solutions, Inc. Fax: (617) 232-1064
mailto:cjmiller<AT SIGN>informed-solutions.com
Brookline, MA 02446 USA Registered 4D Developer
Providers of 4D and Sybase connectivity
http://www.informed-solutions.com
------------------------------------------------------------------------------------------------
This message and any attached documents contain information which may be confidential, subject to privilege or exempt from disclosure under applicable law. These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited. Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication.
Post by Sannyasin Siddhanathaswami
Convert to PNG. If that works, convert again to JPG
Try PICTURE to BLOB, then BLOB to PICTURE instead of CONVERT PICTURE
Try the obsolete " _o_QT COMPRESS PICTURE”
I’ll let you all know what works for these funky pictures.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
****************************

Bernd Fröhlich
2017-02-07 09:54:21 UTC
Permalink
Post by Nigel Greenlee
Hi-if you having trouble with 4D crashing it you might consider exporting the picture in the what ever format it currently is and then using LEP to call the command line to convert it to a JPG, then you can re-import the new picture.
Or export all, use GraphicConverter to do the conversion (it can do batch-conversions) and import again.
<https://www.lemkesoft.de/en/products/graphicconverter/>

Greetings from Germany,
Bernd Fröhlich
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*****************************************************
Bruno LEGAY
2017-02-07 09:54:00 UTC
Permalink
Hi,

Take a look here :
http://forums.4d.fr/Post/FR/17329223/1/17329529#17329529

It is 4D code to parse internal 4D picture format (and extract the various original format picture data).

You can test it to see what's wrong with your pictures…

HTH
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
******************************
Nigel Greenlee
2017-02-07 10:47:25 UTC
Permalink
Bruno.

Nice code.-solid bit of work there..don't mind if I take a copy do you.

Nigel Greenlee
Post by Bruno LEGAY
Hi,
http://forums.4d.fr/Post/FR/17329223/1/17329529#17329529
It is 4D code to parse internal 4D picture format (and extract the various original format picture data).
You can test it to see what's wrong with your pictures…
HTH
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
**********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
********************************
Sannyasin Siddhanathaswami
2017-02-09 02:17:15 UTC
Permalink
Missed this first time around. I’ll try this first to see what’s up with the pictures!

Sannyasin Siddhanathaswami


On 7 Feb 2017, at 09:54, Bruno LEGAY <***@ac-consulting.fr> wrote:

Hi,

Take a look here :
http://forums.4d.fr/Post/FR/17329223/1/17329529#17329529

It is 4D code to parse internal 4D picture format (and extract the various original format picture data).

You can test it to see what's wrong with your pictures…
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*******************************************************
David Adams
2017-02-09 02:50:51 UTC
Permalink
Since you're on a Mac, the earlier suggestion of batch processing with
GraphicConverter is worth a shot. It's not the prettiest program on earth,
and it's definitely not free...but it's got a lot of grunt under the hood.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:4D_Tech-***@lists.4D.com
*************************************************************
Continue reading on narkive:
Loading...