Jump to content

Wikipedia:Reference desk/Archives/Computing/2020 August 16

From Wikipedia, the free encyclopedia
Computing desk
< August 15 << Jul | August | Sep >> August 17 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 16

[edit]

How to mount exFAT on Fedora Linux without sudo?

[edit]

I am using Fedora Linux on my home computer. The physical computer has an SD card reader, but I have found that by default, Fedora Linux doesn't support SD cards of more than 32 GB. This article provided information on how to mount exFAT cards on Fedora Linux, and it worked for me.

The problem is that I have found out that I can only mount exFAT cards as root. This works, because as this is my own, personal, private computer, I naturally have root access to it, but I have to use sudo every time, and type my password. Is there any way to do it more easily, without having to type my password, without compromising security? JIP | Talk 00:59, 16 August 2020 (UTC)[reply]

JIP, you should be able to make an entry in /etc/fstab with the "user" option to allow user mounting. Elizium23 (talk) 13:55, 16 August 2020 (UTC)[reply]
I am and I have. It allows me to mount FAT cards as a normal user but not exFAT cards. For some reason I can only mount exFAT cards as root even when I have the "user" option set. JIP | Talk 14:26, 16 August 2020 (UTC)[reply]
Also, I am also using the option "shortname=lower" in /etc/fstab, meaning that FAT short names (the old MS-DOS 8.3 filenames) should appear as all lowercase on the Linux file system. This works with FAT cards but not with exFAT cards. JIP | Talk 00:10, 17 August 2020 (UTC)[reply]
@JIP: I was wondering if someone more informed may answer but since no one has..... I can't help with the mount problem. But for the shortname problem, what do you mean by 'not with exFAT'? AFAICT there is simply no such thing as short names on exFAT. See our article, and others like [1] [2] [3] [4] [5]. (If I understand correctly, the way exFAT works a FileName longer than 15 characters requires multiple FileName directory records. But a single FileName directory record isn't a short name, it's just the way it's designed you use multiple for longer file names. The second record doesn't hold the file name again, it just holds the second part of the name.) I assume by the time Microsoft was developing exFAT they felt there was no longer any point unlike when they were developing NTFS. To me it makes sense that the option is treated as an invalid one and specifying it is treated as a non-critical error. Even if a file or directory on exFAT happens to have a name that is 8.3 and all upper case, I wouldn't expect the shortname=lower to make it all lower case. (Actually I wouldn't expect it for a FAT12/16/32 either if it has a VFAT with a long name even if it's a duplicate of the shortname including case, but maybe there are some reasons it was felt best.) Nil Einne (talk) 17:10, 21 August 2020 (UTC)[reply]
Also I should clarify when I say 15 characters, I mean 15 characters in UCS-2LE. I think most implementations actually use UTF-16LE, so the number of characters can be less than 15, although precisely what to use isn't clearly specified in the spec [6]. Nil Einne (talk) 17:47, 21 August 2020 (UTC)[reply]
JIP, are you using the fuse-exfat package? FUSE is a user-level filesystem that should be more forgiving of user mounts than an in-kernel solution is. Elizium23 (talk) 17:40, 21 August 2020 (UTC)[reply]

Automatically crop images on Linux

[edit]

I have literally thousands (I kid you not) of JPG image files on my Fedora Linux computer. By far the most of them have white space on the right and bottom edges, in other words, the actual usable image is smaller than the image size. I'd like to crop the white space away from the right and bottom edges. I could do this by hand in GIMP, but this is far too much work for thousands of files.

Is there any way to do this automatically? In other words: Remove all columns and rows of pixels from the right and bottom edges that consist entirely of white (#FFFFFF) pixels. Stop at the first non-white pixel found. Ignore the left and top edges. Save the result either in the same or a new JPG file.

How can I do this? JIP | Talk 01:05, 16 August 2020 (UTC)[reply]

As usually with Linux, the answer probably is ImageMagick. In particular, see the -trim option. By default, it removes all border lines that are all the same colour as corner pixels - this should work in your case, unless you have the same white borders on top and want to preserve them. One problem: If you have jpegs, the borders may look white, but they may actually be different bright shades of grey. You can use -fuzz to make the program consider very similar colours the same. I tried convert -trim -fuzz 10\% +repage mari-final-1.jpg mari-final-1-trimmed.jpg, and it worked well for a single example of a comic I had on my desktop (I suspect 10% may be overkill for photos). The +repage option makes sure that the virtual borders of the image coincide with the real ones. You can probably also specify quality settings for recompression, or specify PNG as output. If the default does not work for you, check this page, which has a lot of tricks to e.g. limit trimming to certain sides. --Stephan Schulz (talk) 08:21, 16 August 2020 (UTC)[reply]
Another solution in case you need to retain left and top borders. Using jpegtopnm from the Netpbm suite you can convert the images to ppm format; a simple C or Python program can then inspect the individual pixels and produce a cropped image. Then convert back to jpeg format with pnmtojpeg. These tools allow you to save and restore any Exif headers.  --Lambiam 08:31, 16 August 2020 (UTC)[reply]
Much as I like Python, it would not be my primary choice for bulk-editing a huge batch of (nowadays probably megapixel-) images pixel by pixel. ;-). --Stephan Schulz (talk) 09:30, 16 August 2020 (UTC)[reply]
Same here, but there are more people now who know Python than C/C++.[7]. Also, you can easily code the whole process in Python, without using the Linux shell. (In theory you can also do that in C with system calls, but that is a coding nightmare if you don't already routinely do such things.)  --Lambiam 18:06, 16 August 2020 (UTC)[reply]
Well, for me not using the Linux shell always sounds like a weakness ;-). But if you prefer Python, ImageMagick also has Python bindings, and I think the functions are much higher-level than Netpbm (cool as that is). And that is a common Python approach: Have a fast library for the expensive stuff, and use Python as the glue. --Stephan Schulz (talk) 20:23, 16 August 2020 (UTC)[reply]
I don't know if Imagemagick JPG cropping is lossless. Lossless cropping is possible with JPGs only if you crop off whole macroblocks. This suggests that jpegtran can do it. I don't know if it can trim borders cleverly. 93.136.48.85 (talk) 03:49, 17 August 2020 (UTC)[reply]
JIP, GIMP's script-fu should be able to do what you want, either with a prepackaged script or one you write yourself. Example. Elizium23 (talk) 17:57, 21 August 2020 (UTC)[reply]

Why four lights on modem, the sequel

[edit]

I was moving some stuff and found the box the modem came in. Inside was a plastic bag with some papers in it, which said "Open me first". So now I know where to find the answer to this question, or at least get closer to the answer. I didn't know these papers even existed.— Vchimpanzee • talk • contributions • 16:30, 16 August 2020 (UTC)[reply]

I looked at the old question and it looks like you are being asked for the make and model of the modem. If you found the box, that should be a very easy thing to answer. 97.82.165.112 (talk) 18:35, 16 August 2020 (UTC)[reply]