Capture specific-sized images with an Ubuntu command-line program - command-line

I am currently working on a project and would like to know if you heard of any command-line tools that lets your webcam take specific-sized images? I found some but none of them works.
In my case, I'd need to capture 1600x1200 pictures.

I was able to use uvccapture -m -x640 -y480 -oimage.jpg.
If your webcam supports 1600x1200, then this method might work. When I try anything more than 640x480, uvccapture prints:
format asked unavailable get width 640 height 480

Related

Getting Retina Screen Resolution on Macs with HiDPI in Unity

I am making a custom Unity Editor GUI window and I just want it to stay and the exact center of the screen. Surprisingly, this is harder than I thought it would be on Macs.
This is my code:
....
windowRect.center = new Rect(0, 0, Screen.currentResolution.width, Screen.currentResolution.height).center;
....
The problem is, on a 5K iMac, which has a native resolution of 5120*2880, by default the macOS uses HiDPI to scale everything to 2560*1440. In Unity, Screen.currentResolution returns 5120*2880 without considering HiDPI scaling, but I need that sweet scaled resolution.
I've tried other functions as well. Display.main.systemWidth returns 1920 instead of 5120 or 2560.
Is there a way to do this? Or am I just out of luck? I am using Unity 2018.1.9f1.
Also, if there is a way to get the size of the whole Unity Editor Window(not the game window), I would be fine with it. Thanks in advance!
In Editor, Screen.currentResolution show the resolution of game window. You can enable Maximize On Play to use the maximized window resolution.
And if you deploy to MacOS app, it should be the 5K resolution correctly.
This in an old thread, but in case someone is still wondering, I found out that the highest resolution returned by Screen.resolutions on a retina device is the « magic » resolution. It’s the one that you see in the device settings as « Looks like X x Y ».
This is not mentioned in the doc as far as I could see, so I am not certain in can be relied upon in the long run, but it’s the case currently with Unity 2018.3.
Not quite the same as centre of the screen, but I was having a similar issue and solved it using:
EditorGUIUtility.GetMainWindowPosition().center;

Custom screen resolution for Android on Raspberry Pi 3

I am using a 7" TFT LCD Display (1024x600) with the Raspberry Pi 3 and I can not make it work with that screen resolution. It looks like it is zoomed in.
I know that there are a bunch of topics about this issue in and out stackoverflow, and I have tried to edit the config.txt as much as I could, never getting different results. (BTW: I got it working with Raspian really easily editing the config.txt, but it does not work for android for some reason).
I used this Android image, and this is how my config.txt looks like:
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1024 600 60
Framebuffer_width=1024
Framebuffer_height=600
disable_overscan=1
config_hdmi_boost=5
kernel=zImage
device_tree=bcm2710-rpi-3-b.dtb
dtparam=audio=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=vc4-kms-v3d,cma-256
initramfs ramdisk.img 0x01f00000
mask_gpu_interrupt0=0x400
avoid_warnings=2
gpu_mem=256
enable_uart=1
I would really appreciate some insight on this.
PS: I tried different resolutions with the hdmi_group and hdmi_mode, according to this RPi article, but the image remains the same.
So I finally got it working by trial and error, and I posted the answer in the RaspberryPi Stackexchange site as suggested. Case closed for now.
I had the same 'zoomed in' effect using Android Studio (React-Native) with an 800*480 HDMI screen (Waveshare 5-inch). When I used Dimensions, within the app, to get the screen size, it returned approx 530 * 300, which had the additional effect of changing the bucket size for images being copied over from the assets folder. My solution, found after some considerable time, was from Dokter_Bibber at this link. It did not give me precisely the same display as my 800*480 Android-Studio-emulator that I was using to develop my page, but pleasingly close.
Quoting from the link:
Start Console window and type :
adb shell wm size 800x480
---AND (186.59 ppi calculated here : https://www.sven.de/dpi/ 4)
adb shell wm density 187
THEN (reboot the device)
adb reboot

How do I simultaneously decrease resolution and increase DPI for an image on the command line?

I'm thinking ImageMagick should be able to do it, but have yet to be able to figure out how. The lack of English Google doesn't help (I'm in China right now).
I'd also appreciate comments about whether this method works for sacrificing resolution to increase "real" DPI.
When you change the DPI of an image, the resolution (in inches) automatically changes accordingly, while the size (in pixels) keeps the same. Therefore commands like convert -units PixelsPerInch -density 600 input.png output.png may suit your needs, in which 600 is the target DPI.

Which ppi is correct in iOS4 images (normal and high res)

I want to add high res images in my iOS4 app. I already read this http://developer.apple.com/iphone/library/documentation/iphone/conceptual/iphoneosprogrammingguide/SupportingResolutionIndependence/SupportingResolutionIndependence.html#//apple_ref/doc/uid/TP40007072-CH10-SW2 and a lot of other pages but I did not find the answer which ppi my image should have.
Currently, I have an image for example button.png with 160ppi and 50x30px. Now I want to create a high res image named button#2x.png. Is it correct to use 326ppi and 100x60px?
I already had a look at other iOS open source apps but each app did it on a different way. Most apps used 72ppi for normal and high res. What is correct?
Thanks for your answers
Walter
To be quite frank, I've not found a need to adjust pixel resolution for my images (i.e. I leave my Photoshop templates at 72 ppi and they're OK). If you just provide the correct dimensions for each format, the system will know how to deal with your images appropriately depending on the resolution of the device it's on.

Create a PDF for iPhone, how to?

I'm trying to write a eBook, for the iPhone, using PDF format.
The problem is, I can't create a PDF with 5 cm x 5 cm (example).
I've tried Adobe Acrobat Pro 9. Didn't work, since it is not possible to custom the paper size.
I've tried Pages 08, but it's also not possible (it's possible to set the custom size, but it doesn't work, might be a bug).
I've tried Microsoft Word. The generated PDF is a mess... Doesn't work right.
So.. I can't create a PDF, with a custom paper size. This is nuts... There must be a tool or something that works right.
Anyone knows any tool that works well?
Thanks
On the Mac (since the underlying drawing system Quartz is based on the same ancestor as PDF), you can always generate PDFs by doing Print->Save as PDF...
This generally gives good results.
I have only a suggestion, but maybe open office?
Given that the iPhone resolution is 320 x 360px with a resolution of 163ppi we need to optimise print settings before exporting our document to PDF. I’m tipping most people will view their document with the iphone orientated in landscape mode so we’ll base our document width on 360px.
So here’s the settings you need to use when exporting or printing your document to PDF:
Width: 125mm x 225mm.
That’s it. Now just print your document to PDF using a PDF printer driver like doPDF and email the document to your iPhone.
Have a look at latex. You can typeset the document to any size that you want. http://www.latex-project.org/