I know that have a simillar question : How to change Ghostscript output file (in printer spooler)
but the answers was not helpful
I using the command :
-q -dBATCH -dNOPAUSE -dNODISPLAY -c "mark /NoCancel true /OutputFile (%printer%Ricoh c2051) /UserSettings << /DocumentName (Test) /MaxResolution 600 >> (mswinpr2) finddevice putdeviceprops setdevice" -f "C:\duplex.pdf"
to set a custom name for document, but if a try to use "-sPAPERSIZE=a4" still the outputpaper size is "LETTER".
then,how to change the paper type when I use these settings?
----Edit
after researching, I found out how to set the paper type.
just added "/ PageSize [595 842]" (a4) at the prompt
then the line becomes:
-q-dBATCH-dNOPAUSE-dNODISPLAY-c "mark / NoCancel true / OutputFile (% printer% Ricoh c2051) / PageSize [595 842] / UserSettings << / DocumentName (Test) / maxResolution 600 >> (mswinpr2) FindDevice setdevice putdeviceprops "-f" C: \ duplex.pdf "****
Your basic problem is that unless you set a fixed media size Ghostscript will set the media size to that which is requested n the PDF file (it will do this for PostScript input as well). Set -dFIXEDMEDIA to fix the media size.
In addition, the mswinpr2 device does not attempt to set the media size on the printer (assuming it has more than one), but simply uses the default.
Related
This PowerShell code divides a large audio file (sound1) in 5 minutes parts and saves them as sound100_1.mp3, sound1_002.mp3...
ffmpeg -i $file_name_complete -f segment -segment_time 300 -c copy $fileNameOnly"_"%03d$fileExtensionOnly
How can I set the metadata title to be the same than the file name?
And how can I also (on the same time) edit the Album metadata with an incremental name (it's useless, but it's to understand how that work). It should be alb_1, alb_2.
I have seen on the docs that I should use:
-metadata title="my title"
But:
should I repeat each time -metadata for each metadata? EDIT: yes according to this
how can I increment the number since the title need to be quoted (-metadata title="$fileNameOnly""_"%03d won't work since the last quote is missing)
how can I set the title field so it take the same value than the Name?
This did not work:
ffmpeg -i $file_name_complete -f segment -segment_time 300
-metadata title="$fileNameOnly""_"%03d album="test"
-c copy $fileNameOnly"_"%03d$fileExtensionOnly
I get this error:
-metadata : The term '-metadata' is not recognized as the name of a cmdlet
How to take a screenshot in Windows 8 and to paste it to a *.jpg file using AutoHotKey script? I want my custom key combination and folder for images
{CustomKey}:: ;image saved in Pictures/Screenshots folder by default
Send #{PrintScreen}
Return
The images are saved as png; can then be converted to jpg and moved to another directory.
Tested in Win 10.
Might work in Win 8 too.
Another question similar asked here:
https://autohotkey.com/board/topic/63742-how-to-save-a-screen-shot-with-ahk/
Problem was that saved file was blank. In my case, the file turned out to be all grey.
Reason was that FileAppend saved as text file.
To save screenshot image taken with PrintScrn button:
; Send {PrintScreen}
FileAppend %ClipboardAll%, FileName.raw, UTF-8
; This can be read back to memory with:
FileRead, Clipboard, *c FileName.raw
; image can also be converted/compressed to save space.
; I already had ffmpeg, so put this:
Run %ComSpec% /c "ffmpeg.exe -f rawvideo -pixel_format rgb32 -s 2256x1504 -i FileName.raw -vf hflip -vf vflip output.png"
Tested on Win 10.
You might try using the Gdip_All.ahk library. I found a maintained version of it at: https://github.com/mmikeww/AHKv2-Gdip/blob/master/Gdip_All.ahk
If you have Irfan View installed you can use this:
run('"C:\Program Files\IrfanView\i_view64.exe" /capture=0 "/convert=path_to_file.png" /jpgq=95')
You can also specify format or quality and include process name, time or other staff, for example:
dir := 'D:\screenshots'
name := winGetProcessName('A') ' ' a_YYYY '-' a_MM '-' a_DD ' ' a_hour '-' a_min '-' a_sec
format := 'png'
quality_jpeg := 95
run('"C:\Program Files\IrfanView\i_view64.exe" /capture=0 "/convert=' dir '\' name '.' format '" /jpgq=' quality_jpeg)
You can check Irfan View command line options in the program help or here.
You can also search some other programs that can silently make screenshots using command line options. If you find another good one let me know.
I would like to display a graph without writing a file first.
Suppose I have a command foo that produces this on standard out:
digraph foogrph {
a -> b;
a -> c;
}
What I would like to do is pipe foo into dot and then pipe the results into a command that will display the image in a graphical environment.
foo | dot -Tpng | <display command>
I have found a workaround that involves temporary files. In OSX, I can do the following:
foo | dot -Tpng > temp && open temp
But I still have to remove the file from the filesystem.
How can I display an image that is being written to standard out?
With ImageMagick's display command, these work on Ubuntu 12.10 (and most likely other OSes, too):
dot abac.dot -Tsvg | display
dot abac.dot -Tpng | display
SVG has the advantage of smoothly scaling with the window (if that's what you want).
On OSX & iTerm2, you can do the following (assuming imgcat is installed)
dot abac.dot -Tpng | imgcat
On Linux you can also just use -Tx11:cairo to display a direct X11 window.
To complete the accepted answer (which is totally OK), if one want to also avoid using a .dot file :
echo 'digraph { a -> b }' | dot -Tpng | display
(this is for linux only, also I first tried eog that doesn't seem accepting pngs through pipes)
Adapted from rom the documentation of graphviz command line usage.
I use OS X Mountain 10.8.2.
I used Automator and added AppleScript, copying the command from the old app's developer at the Iconoodle - Convenient ICNS to PNG image conversion (Iconoodle isn't supported by OS X 10.8 by being a PPC app). I saved the workflow as an application. I selected the images and dropped them into the application, but the images weren't converted to ICNS. I also copied from the question Convert image to .icns file AppleScript Obj-C and it didn't work either.
I'm really frustrated with it. I want to use Automator to convert the multiple images from PNG to ICNS once at all. It's very annoying to convert each image to ICNS in the icon editor applications, one for one. The Preview.app doesn't want to convert the image in format PNG to ICNS because it has only one page, it can convert it to ICNS only if the icon has many pages.
Do you know to make it?
Thank you for your attention, help and patience!
Here is another approach...
NOTE: Your ORIGINAL pngs will be scaled to the expected size before the icns file is created. If you want to keep a copy of the original png, duplicate it first. You can also add a line or so to the script to do so automatically.
property expectedSizes : {16, 32, 48, 128, 256, 512, 1024, 9999999}
set myFiles to choose file with multiple selections allowed
repeat with aFile in myFiles
tell application "System Events" to set bPath to POSIX path of (container of aFile)
set newPath to bPath & "/" & bName(aFile) & ".icns" as text
set aFile to quoted form of (POSIX path of aFile)
set {W, H} to {paragraph 1, paragraph 2} of (do shell script "sips -g pixelWidth -g pixelHeight " & aFile & " | grep -Eo [0-9]*$")
set {W, H} to {W as number, H as number}
if W > H then
set W to eSize(W)
do shell script "sips " & aFile & " -Z " & W & " -p " & W & space & W & " --padColor FFFFFF -i"
delay 1
else if H > W then
set H to eSize(H)
do shell script "sips " & aFile & " -Z " & H & " -p " & H & space & H & " --padColor FFFFFF -i"
delay 1
-- H = W but not in expected sizes
else if H is not in expectedSizes then
set H to eSize(H)
do shell script "sips " & aFile & " -Z " & H & " -p " & H & space & H & " --padColor FFFFFF -i"
delay 1
end if
do shell script "sips -s format icns " & aFile & " --out " & quoted form of newPath
end repeat
on bName(theFile)
tell application "Finder" to set {name:fileName, name extension:nameExtension} to theFile
set baseName to text 1 thru ((get offset of "." & nameExtension in fileName) - 1) of fileName
end bName
on eSize(lDimen)
repeat with i from 1 to 8
if lDimen < item i of expectedSizes then return item (i - 1) of expectedSizes
end repeat
end eSize
You can still run the iconoodle script by just pasting it to AppleScript Editor. It's just a wrapper for sips, but it can only convert icns to png.
You can use sips directly to convert png to icns:
for f in *.png; do sips -s format icns "$f" --out "${f%png}icns"; done
we're trying to convert pdf's to ps files with ghostscript using the ghostscript commandline tool. Somehow we can't find a parameter to set the amount of copies that should be printed.
So if we'd want to print a file twice we'd have to send it two times, there should probably be a simple parameter that tells the printer to print this more often, but I can't find it. Can somebody help me out?
Thanks!
edit:
Converting PDF -> PS using
gswin32c.exe ^
-dSAFER -dBATCH -dNOPAUSE ^
-sDEVICE=pswrite ^
-sOutputFile=out.ps ^
in.pdf
Working on windows..
PDF files, unlike PostScript files, have no means for setting the number of copies. You don't say how you are printing the file, but I suspect that :
... -c "<<
/NumCopies 2>> setpagedevice" -f..."
would work. But without knowing what you are doing I can't be sure.