How do I script converting a .psd or .ai file into multiple sized PNGs? - image-manipulation

For iPhone programming, I need my application icon in many sizes.
Rather than have my designer export one by one, is there a way I can script photoshop, illustrator, or just use Python or something to convert a .PSD or .AI file into several different sizes of .PNG?

My best guess would be to create an action in Photosop (sort of making a Macro) and doing a batch in the File -> Automate -> Batch option.
Check this link out for more info (Mac based tutorial but i've done it in the PC version).

Related

Visio .vsdx format unzip and zip corrupts

I'm attempting to modify a Visio file (Open XML format) without having to use the Windows Visio application. My first experiment is just to use 7zip to unzip a known good .vsdx file that was created using Visio. That is all good; I can view the content of the package. Without making any modifications, I use 7zip to re-zip the content and renamed to .vsdx, but when I tried to open the resulting new file using Visio, it complains that the file is corrupt. Is there a way to manually re-zip the content into something that Visio accepts as a valid Visio file? I suspect that there may be some sort of checks for the validity of the file, but can't find what that may be. Thanks for any input.
I would use some form of OpenXML library to get at the file's guts using some sort of "approved magic".
Understanding that you might not want to do whatever you're doing via programming, I looked for some sort of free editor.
I found this free plug-in for Visual Studio:
https://marketplace.visualstudio.com/items?itemName=bsivanov.OpenXMLPackageEditorforVisualStudio
It works in the free "Microsoft Visual Studio Community 2019" as well. I just opened the dev environment (aka: the application) and dragged a Visio .vsdx file into the app. It opened with a tree-like editor. I was able to dig down until I found the visio > pages > page1.xml "leaf". Inside there, I was able to change some text on a shape, then save the "package".
Whatever this tool does, it saves the file properly, and I was able to open the altered .vsdx file in Visio. And the text that I changed in the editor was indeed changed inside of Visio!
I think I've used this in the past:
"Welcome to the Open XML SDK 2.5 for Office"
https://learn.microsoft.com/en-us/office/open-xml/open-xml-sdk
https://github.com/OfficeDev/Open-XML-SDK
To edit Visio files without the Visio application, you'll still need to understand how Visio works, to some extent.
A simple example:
I changed the text on a shape fairly easily within one of the page.xml files. That was easy. Then I wanted to add a copy of that shape. It was simple enough to copy and paste the whole xml block for the existing shape, then change the PinX and PinY attributes to move the shape to a different location on the page.
But you won't see that shape unless you give it a unique ID within the page. I tested deleting the ID attribute (to see if Visio would figure it out on open and assign one automatically), but it didn't work. If the ID is the same as another shape, the shape is ignored when you open the file. Once I changed ID to something unused, I did see the new copy of the shape.
If you create grouped shapes, or shapes that have advanced behavior (SmartShapes, ShapeSheet formulas, etc.), then this could get complicated. As formulas need to reference other shapes by ID, so you need to manage the IDs! For simple boxes and lines, etc., it might work well (and fast) to generate these things via OpenXML. Good luck!

Can I use png images inside a resource dll with ImageSearch function?

So, I want to develop a simple automation script for myself and distribute it to some friends and want it to look professional.
The script uses some png files (in the script root folder) to do ImageSearch function.
The thing is that I don't want to distribute it with png files (I know about FileInstall) or to have the programs install the png files in the script directory. What I really want is a dll packed with the png images, so that the common user doesn't even know that the file contains images (or a similar solution) and be able to access them from the script.
My question then is: Is it possible to use ImageSearch and make it use images inside a dll packed with pictures? Any similar approach that I can use not to have png files along the script?
Best regards!
From the link you posted, it appears that this is indeed possible to use ImageSearch with DLL files as it is explicitly mentioned.
Other sources of icons include the following types of files: EXE, DLL, CPL, SCR, and other types that contain icon resources.
Note that you may need to scale the image(s) if these are not actually icons.
. . . icons loaded from ICO, DLL, or EXE files are scaled to the system's default small-icon size, which is usually 16 by 16 (you can force the actual/internal size to be used by specifying *w0 *h0).
As for a similar approach, you could alternatively use one of the other file formats mentioned instead of DLL.

How to convert cgm to png on windows

I want to convert a .cgm file to an image file (.png) on windows.
Are there any freeware/opensource tools for this? I tried to ImageMagik but it does not support this operation. Commandline inteface will be an added advance if any of the tools provide it.
UniConvertor is open source, and the best choice in my opinion.
The windows binaries worked great for me, https://sk1project.net/uc2/download/
From a command line you'd simply type uniconvertor input.cgm output.png
You can try https://cortona3d.com/en/cortona2d-viewer-download. When installed it understand .cgm extension and directly opens in IE and you can view it/or take snapshot.
Other tool that you can try(but not free) is reaConverter(https://www.reaconverter.com/)
It has a nice command line interface that converts cgm to PNG directly
There is a free tool available XnView which is very handy when it comes to view, resize and edit your images. It supports more than 500 different formats. But you will have to download an additional plug-in https://www.cadsofttools.com/products/plugins-for-3d-party-programs/ It will enable your need to deal with CGM file formats.

Programmatically convert Doc(x) files to PDF using Microsoft Word

We are developing a Java application that needs to programmatically convert .rtf, .doc and .docx files to PDF files.
Formatting is important to us, so we need the page numbers to be the same between a source file and a target PDF file, and the contents of each page being the same as the original file.
We have tried out open source solutions, such as JODConverter to invoke a LibreOffice of OpenOffice installation, Docx4j and XDocReport. The best formatting was achieved with LibreOffice. However, even in that case, the pages were different (for example, a 87-page .rtf file results in an 80-page PDF file).
So, we think that the ideal way to make the conversion would be to somehow invoke Microsoft Word though our Java application, and make the conversion with it. That would produce PDF files that have the same formatting as the original files.
Is this possible in any of the following ways:
An API that is directly invokeable through Java?
An API that is invokeable through a .Net language and we would use that with something like JACOB?
A 3rd party library that uses a Microsoft Word installation under the hood (something like JODConverter for Word)?
A CLI interface supported by Word (relevant question)?
Something else?

How can I output tables to a PDF file with the iPhone SDK?

I want to output a PDF using UIKit's PDF creation methods. I see plenty of information on the web about creating a graphic context in a PDF, but I want to create smart text tables whose cells the user can later copy and paste into other applications (Word, Excel, etc.). How do I do this?
Unfortunately, that's not trivial. I recommend you the libharu PDF library for iPhone as a good point to start from.