Wikipedia:Reference desk/Archives/Computing/2022 January 22

= January 22 =

Strange result from code to make an arbitrary azimuthal equidistant projection from an equirectangular projection
Hi Python coders,

I wish to render Danny Quah's Valeriepieris circle in azimuthal equidistant projection centred on a given latitude and longitude, by transforming the equirectangular projection File:Earthmap1000x500.jpg, and found formulas for the transformation from (x, y) to (lat, long) at http://mathworld.wolfram.com/AzimuthalEquidistantProjection.html. However my Python 2 code below which uses PyPNG gives me the image in the thumbnail.

Can someone please point out where it went wrong (and a possible remedy)?

Thanks, cm&#610;&#671;ee&#9094;&#964;a&#671;&#954; 01:51, 22 January 2022 (UTC)


 * I would suggest asking this question on a more targeted Q&A site such as Stack Overflow, where you may find more viewers with the necessary skills to help. That said, my first impression is that the issue may be one of units. Your code is working in a mix of pixel coordinates, degrees, and radians. I suspect you are missing a conversion somewhere. In particular, your out_x/out_y variables appear to be pixel coordinates, but the first two parameters of azimuthal_equidistant_to_equirectangular seem to be expecting an angle (degrees?), presumably limited to some expected range. -- Tom N talk/contrib 17:02, 23 January 2022 (UTC)
 * A superficial examination of the formulas at MathWorld suggests that the values for the first two parameters of  should be given with the Earth radius as unit, so the value of   should not exceed  .  --Lambiam 23:37, 23 January 2022 (UTC)
 * Many thanks! You're right. I've now fixed it as above. Cheers, cm&#610;&#671;ee&#9094;&#964;a&#671;&#954; 01:45, 23 February 2022 (UTC)

Get Firefox to open files in new tab in last active window
Using Firefox on Mac – if I have the browser set as my default to open, say, jpegs from Finder, how do I get it to stop opening them in new windows, and to instead open them in a new tab in the last active window? I've set browser.link.open_newwindow.override.external to 3, but it doesn't work. --Lazar Taxon (talk) 17:27, 22 January 2022 (UTC)

Linux command-line program for JPG analysis
I am looking for a command-line program for Linux that would take a JPG file as an input parameter, and instead of displaying it, would print information about it on stdout. The only real requirement is that it should print the image dimensions, i.e. width and height. Is there one? J I P &#124; Talk 20:09, 22 January 2022 (UTC)
 * The  command will print basic information about a jpg file. If you need more detailed information you might look at ImageMagick. CodeTalker (talk) 20:18, 22 January 2022 (UTC)
 * will give you all the metadata. You can filter using the tool, or else pipe the output into either   or   which is less efficient but more flexible.

$ exiftool O_come_O_come.jpg | grep Image Image Width                    : 6392 Image Height                   : 4240 Image Size                     : 6392x4240
 * for example. Martin of Sheffield (talk) 21:20, 22 January 2022 (UTC)


 * If you have the ImageMagick package installed you can also use :

$ identify O_come_O_come.jpg O_come_O_come.jpg JPEG 6392x4240 6392x4240+0+0 8-bit sRGB 424627B 0.000u 0:00.000
 * This also works on several other formats, such as PNG and GIF. --Lambiam 23:15, 23 January 2022 (UTC)
 * Thanks Lambian. The actual output is   Martin of Sheffield (talk) 23:21, 23 January 2022 (UTC)