Hack Forums
[Python] [Source] Random image downloader by size - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] [Source] Random image downloader by size (/showthread.php?tid=6182075)



[Source] Random image downloader by size - Edge - Nov 22, 2021

Hey! I've been practicing python and messing around with APIs. This script will download the number of images you want based on the size you declare using Lorem Picsum.

[Image: 960ef4764b1a698f9b2047eaecd1acbc.png]

I added a lot of comments incase you are learning as well.

Source CodeSpoiler (Click to View)

I also converted it to an EXE using pyinstaller which makes it easier to run but virustotal thinks its a virus so I won't upload lmao

Thanks (:


RE: [Source] Random image downloader by size - TransfemMarxist - Dec 7, 2021

Tiny improvement you could make to your code
instead of using i to define your numbers in the files, you could simply just use the variable in your for range() loop

and instead of converting your count to an int after the function, you can change the function to
Code
def getimg(width: int, height: int, count: int):

this will ensure that your variables are integers when your function starts


RE: [Source] Random image downloader by size - Akumi - Dec 13, 2021

I did a little project similar to this however I was using a public anime image API aha


RE: [Source] Random image downloader by size - Edge - Dec 13, 2021

(Dec 13, 2021 01:58 PM)Akumi Wrote:  I did a little project similar to this however I was using a public anime image API aha

I love APIs lol