Wikipedia:Reference desk/Archives/Computing/2021 February 8
Computing desk | ||
---|---|---|
< February 7 | << Jan | February | Mar >> | February 9 > |
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. |
February 8
[edit]Where could I convert a very large TIFF file to JPEG online for free?
[edit]So, I really would like to convert a very large TIFF file (860 MB) to JPEG, specifically this one. On a MacOS, I would normally use the export function on Preview for this but due to this file's large size, it freezes my computer. Is there a way to do this online at no cost? StellarHalo (talk) 04:05, 8 February 2021 (UTC)
- StellarHalo, have you used Homebrew (package manager) before? ImageMagick should do what you want. Elizium23 (talk) 04:12, 8 February 2021 (UTC)
- It won't cause my computer to freeze dealing with such a large file? I would like to avoid such a scenario if possible hence why I prefer a completely online method. StellarHalo (talk) 04:14, 8 February 2021 (UTC)
- I confirm that ImageMagick was able to convert the image to JPEG for me, but that doesn't help if you can't get the original file onto your machine in the first place. By the way, it did give a warning Incompatible type for "RichTIFFIPTC"; tag ignored. but the JPEG still came out all right. --142.112.149.107 (talk) 04:53, 8 February 2021 (UTC)
- I am confused about the parameters of this problem. You first indicate that the file is on your local system, and now you are unable to put it on your local system.
- The answer is that any system with a Linux or Unix-like shell, that has ImageMagick installed, will work. You can obtain a free shell account from a provider, you can get a free VPS account, such as Amazon AWS or Digital Ocean, there are myriad ways to get a remote connection to a Linux shell.
- I don't know where your hypothetical or actual file lives, if not on your local machine, but transferring that file to your shell system is left as an exercise for the reader. Elizium23 (talk) 05:14, 8 February 2021 (UTC)
- The link in the original posting identifies this as a Commons image. --Lambiam 13:11, 8 February 2021 (UTC)
- I confirm that ImageMagick was able to convert the image to JPEG for me, but that doesn't help if you can't get the original file onto your machine in the first place. By the way, it did give a warning Incompatible type for "RichTIFFIPTC"; tag ignored. but the JPEG still came out all right. --142.112.149.107 (talk) 04:53, 8 February 2021 (UTC)
- It won't cause my computer to freeze dealing with such a large file? I would like to avoid such a scenario if possible hence why I prefer a completely online method. StellarHalo (talk) 04:14, 8 February 2021 (UTC)
- @StellarHalo: The previews of that image are in JPEG. So, if 1059x1024 is acceptable, use this one: [1] Also, the source of that image [2] has a JPEG download link for it. You can also try the excellent GraphicConverter program for Mac, you can download for free to try it before buying. RudolfRed (talk) 04:16, 8 February 2021 (UTC)
- @RudolfRed: I want to convert the TIFF file to JPEG solely because I want a JPEG version at the original 17,631 x 17,053 pixels which is not available at the original source. StellarHalo (talk) 05:04, 8 February 2021 (UTC)
Never mind. I was able to convert it online using cloudconvert.com. StellarHalo (talk) 05:52, 8 February 2021 (UTC)
- Be aware that TIFFs can be lossless (depends upon the internal storage format) but that JPEGs are lossy. Therefore your 17Kx17K JPEG is unlikley to be the same, at a pixel level, as your TIFF. -- SGBailey (talk) 11:40, 8 February 2021 (UTC)
- If the problem is that your browser is trying to open the file (I'm surprised a browser can open a TIFF, but who k nows) and it hangs, you should force your browser to download the file. On Windows and most other *nixes and on most browsers, a simple way is to right click on the "original file" link and choose save link as. On Mac OS X and Safari it's probably the same but if you don't have a right mouse button you may have to use control click. I can't imagine any modern browser would crash or hang trying to download the file although at 860MB if you have a very slow internet connection it may take a while or if your internet connection is unreliable it might fail. An an alternative, you should be able to use any download utility that understands HTTPS to download using this url https://upload.wikimedia.org/wikipedia/commons/4/4f/Yukon_Delta_ESA388851.tiff Note that clicking it could crash or hang your browser, just like if you click on the original file link since it's the same thing. You would want to copy it from here to whatever program you are using. (Or right click to copy URL.) Nil Einne (talk) 13:11, 8 February 2021 (UTC)
That is crazy, why is there such a huge tiff file on commons? Anyway yeah there's utilities around that can do it, so it's just a matter of mooching or spinning up a server for the purpose. I'd do it but it looks like you have already handled it. 2602:24A:DE47:BB20:50DE:F402:42A6:A17D (talk) 05:12, 12 February 2021 (UTC)
- Wouldn't you love to have a clone of Google Earth in your commons too? It's cool man! Because it is there! Just like the Everest. 2003:F5:6F05:0:B8F0:5871:3EA1:202D (talk) 22:33, 15 February 2021 (UTC) Marco PB
More websites asking to disable AdBlocker
[edit]I've noticed that now there are more sites relying on ads and asking to turn off my browser AdBlocker than some time ago. Recently even Imgur asks that. Is this a real trend? 212.180.235.46 (talk) 18:33, 8 February 2021 (UTC)
- Websites have relied on ads for over 25 years now. What's changed is the prevalence of ad blockers but even more so, the ability of website code to detect them. So yes, you will see it more often, as countermeasures are made available to webmasters. Elizium23 (talk) 19:17, 8 February 2021 (UTC)
- There's slow a back-and-forth technology war between websites and adblockers. Websites want to detect when adblockers are being used so they can nag you about it, but adblockers don't want to be detected so you can't get nagged about it.
- Sometimes the web designers are winning, sometimes the adblockers are winning. Make sure your adblocker is up to date. ApLundell (talk) 06:36, 9 February 2021 (UTC)
- My Adblock has an "Adblock Warning Removal List", so that takes care of that. You can also install precision tools like uMatrix to take care of worse countermeasures. 93.142.79.0 (talk) 13:28, 10 February 2021 (UTC)
Importing modules in coding challenge
[edit]In this job interview problem:
Input: "aaaabbbcca" Output: [("a", 4), ("b", 3), ("c", 2), ("a", 1)]
Is it OK to import libraries? For example, in Python3:
from itertools import groupby [(x, sum(1 for item in group)) for x, group in groupby(input)]
As a matter of fact, the itertools module is a gem for such kind of problems.
Otherwise, this would do too, but it's more verbose:
l = [[input[0],1]] for i in input[1:]: if i == l[-1][0]: l[-1][1] += 1 else: l.append([i,1]) [tuple(x) for x in l]
Bumptump (talk) 22:13, 8 February 2021 (UTC)
- Bumptump, it seems to me that that would be a question for the interviewer. Elizium23 (talk) 22:28, 8 February 2021 (UTC)
- Indeed, you will need to ask whoever is running the challenge what the rules are. RudolfRed (talk) 23:29, 8 February 2021 (UTC)
- Ok, just thought that there was a general expected MO for this type of things. Bumptump (talk) 23:48, 8 February 2021 (UTC)
- It may depend on what the prospective employer is seeking, but as an interviewer I'd appreciate a job candidate's knowledge of existing libraries, which suggests experience, higher productivity (not spending time on reinventing the wheel) and better maintainability (more pythonic code). If the point of the question (assuming it has a point) was to test the candidate's ability to unfold the logic and translate it into detailed step-by-step code, I'd insist they produce a solution not using a library, while not holding the library suggestion against them. --Lambiam 02:15, 9 February 2021 (UTC)
- I guess the context can sometimes make it obvious. If the question is to find the shortest path between two nodes in a graph, a five-liner starting with
from networkx import dijkstra_path
is probably not acceptable. If the question is how to handle a pool of cars ferrying around in the city with constraints on driver working time and fuel expenses, you can probably assume you have access to libraries for the menial work. For the question asked, it is not obvious to me which way the wind blows. TigraanClick here to contact me 16:45, 15 February 2021 (UTC)
- Ok, just thought that there was a general expected MO for this type of things. Bumptump (talk) 23:48, 8 February 2021 (UTC)
- Indeed, you will need to ask whoever is running the challenge what the rules are. RudolfRed (talk) 23:29, 8 February 2021 (UTC)
If I were interviewing you I'd give you some points for the groupby solution, then ask for a "verbose" solution. Assuming that the one you posted works, you'd get more points for writing a working one, especially if you did it quickly, but I think it leaves some room for improvement in coding style. One exercise that I like to do myself and that I recommend for people is to spend some time on problems like this (i.e. more time than would be ok in an interview) trying to write the cleanest and nicest implementation that you can, rather than just a working one. The point of the exercise is to develop your sense of coding style, like writing poetry helps develop your sense of natural language. 2602:24A:DE47:BB20:50DE:F402:42A6:A17D (talk) 22:34, 12 February 2021 (UTC)