Script to draw an image onto r/place

Overview

Reddit Place Script 2022

About

Script to draw an image onto r/place (https://www.reddit.com/r/place/)

Requirements

Python 3 (https://www.python.org/downloads/)

How to Get App Client ID and App Secret Key

You need to generate an app client id and app secret key in order to use this script.

Steps:

  1. Visit https://www.reddit.com/prefs/apps
  2. Click "create (another) app" button at very bottom
  3. Select the "script" option and fill in the fields with anything

Python Package Requirements

Install requirements from 'requirements.txt' file.

pip3 install -r requirements.txt

Get Started

Create a file called '.env'

Put in the following content:

ENV_PLACE_USERNAME='["developer_username"]'
ENV_PLACE_PASSWORD='["developer_password"]'
ENV_PLACE_APP_CLIENT_ID='["app_client_id"]'
ENV_PLACE_SECRET_KEY='["app_secret_key"]'
ENV_DRAW_X_START="x_position_start_integer"
ENV_DRAW_Y_START="y_position_start_integer"
ENV_R_START='["0"]'
ENV_C_START='["0"]'
  • ENV_PLACE_USERNAME is the username of the developer account
  • ENV_PLACE_PASSWORD is the password of the developer account
  • ENV_PLACE_APP_CLIENT_ID is the client id for the app / script registered with Reddit
  • ENV_PLACE_SECRET_KEY is the secret key for the app / script registered with Reddit
  • ENV_DRAW_X_START specifies the x position to draw the image on the r/place canvas
  • ENV_DRAW_Y_START specifies the y position to draw the image on the r/place canvas
  • ENV_R_START specifies which x position of the original image to start at while drawing it
  • ENV_C_START specifies which y position of the original image to start at while drawing it

Note: Multiple fields can be passed into the arrays to spawn a thread for each one.

Change image.jpg to specify what image to draw. One pixel is drawn every 5 minutes and only jpeg images are supported.

Run the Script

python3 main.py

Multiple Workers

If you want two threads drawing the image at once you could have a setup like this:

ENV_PLACE_USERNAME='["developer_username_1", "developer_username_2"]'
ENV_PLACE_PASSWORD='["developer_password_1", "developer_password_2"]'
ENV_PLACE_APP_CLIENT_ID='["app_client_id_1", "app_client_id_2"]'
ENV_PLACE_SECRET_KEY='["app_secret_key_1", "app_secret_key_2"]'
ENV_DRAW_X_START="x_position_start_integer"
ENV_DRAW_Y_START="y_position_start_integer"
ENV_R_START='["0", "0"]'
ENV_C_START='["0", "50"]'

The same pattern can be used for 3 or more threads drawing at once. Note that the "ENV_PLACE_USERNAME", "ENV_PLACE_PASSWORD", "ENV_PLACE_APP_CLIENT_ID", "ENV_PLACE_SECRET_KEY", "ENV_R_START", and "ENV_C_START" variables should all be string arrays of the same size.

Also note that I did the following in the above example:

ENV_R_START='["0", "0"]'
ENV_C_START='["0", "50"]'

In this case, the first worker will start drawing from (0, 0) and the second worker will start drawing from (0, 50) from the input image.jpg file.

This is useful if you want different threads drawing different parts of the image with different accounts.

Comments
  • Extension of r/place canvas area + new colors

    Extension of r/place canvas area + new colors

    It seems like new colors have been added and the canvas has been made bigger. This causes the following issue:

    Traceback (most recent call last):
      File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
        self.run()
      File "/usr/lib/python3.10/threading.py", line 946, in run
        self._target(*self._args, **self._kwargs)
      File "/home/user/reddit-place-script-2022/main.py", line 492, in task
        current_r, current_c, new_rgb = get_unset_pixel(
      File "/home/user/reddit-place-script-2022/main.py", line 284, in get_unset_pixel
        if pix2[x + pixel_x_start, y + pixel_y_start] != new_rgb:
    IndexError: image index out of range
    

    I think it shouldn't be that hard to fix, but I am low on time right now.

    help wanted 
    opened by kinnounko 38
  • Added Support for Tor with automatic reconnecting

    Added Support for Tor with automatic reconnecting

    basically what the title says. It can be turned on and off and it can be used with an integrated binary or your own tor executable. I had to use httptunnel because I couldn't get socks working and didn't want to waste my time fixing soemthing that seems to workl. If you spot something that I should change, just tell me! Additional information in the readme.

    opened by LukachoLombardi 21
  • [BUG] 498581890.0 seconds until next pixel is drawn

    [BUG] 498581890.0 seconds until next pixel is drawn

    I have no idea what's causing this. The delay doesn't show when I manually place a pixel. Also, is the Thread #ID the same as the account array number?

    bug rate limited 
    opened by deleniti 21
  • [BUG] Failed setting options from json

    [BUG] Failed setting options from json

    • [Y] I am using the latest version of the code.
    • [Y] I am absolutely sure I read the README in its entirety.
    • [Y] I have made sure this is not a duplicate issue.
    • [Y] I have filled out this form correctly.

    Describe the bug

    my json was fine 5 hours ago but now i get this

    Failed setting options from json. Please read README and check if you have everything in correctly. If issues are still happening then create a issue

    To Reproduce

    Steps to trigger the bug:

    1. download latest main branch
    2. run it

    Expected behavior

    should have started 2 threads

    bug 
    opened by Nebula6 18
  • [BUG]

    [BUG]

    i cant get it to start. when i run it it gets the board image and then says this:

    [INFO] - Received board image: https://hot-potato.reddit.com/media/canvas-images/1648925526247-0-f-1CpMuJKu.png
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
        self.run()
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
        self._target(*self._args, **self._kwargs)
      File "main.py", line 435, in task
        current_c,
      File "main.py", line 224, in get_unset_pixel
        if pix2[x + pixel_x_start, y + pixel_y_start] != new_rgb:
    IndexError: image index out of range
    
    bug 
    opened by noyza2132 17
  • Failed to connect to websocket [BUG]

    Failed to connect to websocket [BUG]

    Bug Report Form

    Checklist

    • [ Y ] I am using the latest version of the code.
    • [ Y ] I am absolutely sure I read the README in its entirety.
    • [ Y ] I have made sure this is not a duplicate issue.
    • [ Y ] I have filled out this form correctly.

    Describe the bug

    When I launch start.bat, "2022-04-03 20:10:35.519 | ERROR | main:task:531 - Failed to connect to websocket, trying again in 30 seconds..." shows up. I doesn't place pixels

    To Reproduce

    Steps to trigger the bug:

    1. Go to 'reddit-place-script-2022-main'
    2. Click on 'start.bat'
    3. See error

    Expected behavior

    Works and place pixels

    Additional context

    Add any other context about the problem here.

    bug 
    opened by Enyrox 15
  • KeyError: 'access_token'

    KeyError: 'access_token'

    This is the log I'm getting when I run main.py, what can I do to fix this?

    available colors (rgb):  [(255, 69, 0), (255, 168, 0), (255, 214, 53), (0, 163, 104), (126, 237, 86), (36, 80, 164), (54, 144, 234), (81, 233, 244), (129, 30, 159), (180, 74, 192), (255, 153, 170), (156, 105, 38), (0, 0, 0), (137, 141, 144), (212, 215, 217), (255, 255, 255)]
    image size:  (34, 21)
    done drawing image locally to new_image.jpg
    330 seconds until next pixel is drawn
    refreshing access token...
    received response:  {"error": "invalid_grant"}
    Traceback (most recent call last):
      File "C:\Users\rishw\Downloads\place_frc\1\main.py", line 189, in <module>
        access_token = response_data["access_token"]
    KeyError: 'access_token'
    
    opened by rishvidh 15
  • What am I doing wrong here?

    What am I doing wrong here?

    Not sure what I'm doing wrong here, set everything out, checked my config file. So I'm a little lost

    Exception in thread Thread-1 (task): Traceback (most recent call last): File "C:\Program Files\Python310\lib\threading.py", line 1009, in _bootstrap_inner self.run() File "C:\Program Files\Python310\lib\threading.py", line 946, in run self._target(*self._args, **self._kwargs) File "C:\Users\oof\Desktop\reddit-place-script-2022-main\main.py", line 594, in task current_r, current_c, new_rgb = self.get_unset_pixel( File "C:\Users\oof\Desktop\reddit-place-script-2022-main\main.py", line 408, in get_unset_pixel new_rgb = self.closest_color(target_rgb) File "C:\Users\oof\Desktop\reddit-place-script-2022-main\main.py", line 106, in closest_color if target_rgb[3] != 0: IndexError: tuple index out of range

    bug 
    opened by jdroo 14
  • Issue in main.py

    Issue in main.py

    Bug Report Form

    Checklist

    • [X] I am using the latest version of the code.
    • [X] I am absolutely sure I read the README in its entirety.
    • [X] I have made sure this is not a duplicate issue.
    • [X] I have filled out this form correctly.

    Describe the bug

    C:\Users\branmart\Desktop\redditbot>py main.py [02-Apr-22 15:53:15] :: [INFO] - place-script started Traceback (most recent call last): File "C:\Users\branmart\Desktop\redditbot\main.py", line 560, in client = PlaceClient() File "C:\Users\branmart\Desktop\redditbot\main.py", line 31, in init self.json_data = self.get_json_data() File "C:\Users\branmart\Desktop\redditbot\main.py", line 100, in get_json_data json_data = json.load(f) File "Z:\Python\lib\json_init_.py", line 293, in load return loads(fp.read(), File "Z:\Python\lib\json_init_.py", line 346, in loads return _default_decoder.decode(s) File "Z:\Python\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "Z:\Python\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 5 column 32 (char 125)

    To Reproduce

    Steps to trigger the bug:

    1. Execute py main.py in cmd

    Expected behavior

    Placed dots for number of workers.

    Additional context

    N/A

    bug 
    opened by branmart 14
  • Question. how to enter the coordinates correctly

    Question. how to enter the coordinates correctly

    I have a picture measuring 60 by 20 pixels, but I don't quite understand what coordinates need to be entered into ENV_R_START and ENV_C_START to start drawing a picture from the upper left corner

    opened by SileboxUnderfined 14
  • Extreme rate limiting

    Extreme rate limiting

    Ran this script with a small set of accounts and started receiving responses with rate limit errors, claiming my next available time is some absurdly high number:

    received response: {"errors":[{"message":"Ratelimited","path":["act"],"extensions":{"nextAvailablePixelTs":1648869782000}},{"message":"ratelimit hit, next available: 1648869782000","path":["act"]}],"data":null}

    received response: {"data":{"act":{"data":[{"id":"...","data":{"nextAvailablePixelTimestamp":1.648871046e+12,"__typename":"GetUserCooldownResponseMessageData","__typename":"GetUserCooldownResponseMessageData"},"__typename":"BasicMessage","__typename":"BasicMessage"}, ...

    And thus no pixels get placed, even if I restart the script. Seems like I've triggered an anti-botting measure. Does not seem necessarily related to IP as I am still able to place on another account on a different device.

    An immediate thought that comes to mind might be staggering the threads by a few seconds so they aren't all hitting the API at the same exact moment.

    opened by colingoodman 12
  •  Failed to connect to websocket [BUG]

    Failed to connect to websocket [BUG]

    Bug Report Form

    Checklist

    • [ x] I am using the latest version of the code.
    • [ x] I am absolutely sure I read the README in its entirety.
    • [x ] I have made sure this is not a duplicate issue.
    • [ x] I have filled out this form correctly.

    Describe the bug

    been an hour since whenever i run it, this bug comes out.

    To Reproduce

    Steps to trigger the bug: run on MacOS

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected behavior

    Replace this text with what should have happened if no bug occurred.

    Additional context

    Add any other context about the problem here.

    bug 
    opened by ramibna 6
  • [BUG] Failed to connect to websocket (WILLING TO PAY FOR HELP!)

    [BUG] Failed to connect to websocket (WILLING TO PAY FOR HELP!)

    Bug Report Form

    Checklist

    • [ yes ] I am using the latest version of the code.
    • [ yes ] I am absolutely sure I read the README in its entirety.
    • [ kinda ] I have made sure this is not a duplicate issue.
    • [ i think ] I have filled out this form correctly.

    Describe the bug

    I can't get this to work, i know nothing about python but I followed a tutorial on youtube step by step and no luck.

    To Reproduce

    Steps to trigger the bug:

    1.start.bat 2.loads 2.websocket error

    Expected behavior

    It should work lol

    Additional context

    2022-04-04 16:51:14.932 | INFO | src.utils:load_image:35 - Converted to rgba 2022-04-04 16:51:14.935 | INFO | src.utils:load_image:38 - Loaded image size: (70, 80) 2022-04-04 16:51:16.099 | ERROR | main:task:535 - Failed to connect to websocket, trying again in 30 seconds... 2022-04-04 16:51:18.105 | ERROR | main:task:535 - Failed to connect to websocket, trying again in 30 seconds... 2022-04-04 16:51:20.106 | ERROR | main:task:535 - Failed to connect to websocket, trying again in 30 seconds... 2022-04-04 16:51:22.119 | ERROR | main:task:535 - Failed to connect to websocket, trying again in 30 seconds...

    bug 
    opened by ghost 26
  • Fun weekend: Bot stats

    Fun weekend: Bot stats

    This was a fun project for the weekend. Thanks to all who helped.

    Some stats: The repo had 5,118 Clones from 3,045 Unique cloners (idk if this includes clones of forked repos) The repo has received: 324,566 Views from 89,550 Unique visitors

    Until next time

    congrats 
    opened by ixi2101 2
  • [BUG] Succeeded placing pixel but nothing happens after.

    [BUG] Succeeded placing pixel but nothing happens after.

    Thread #0 - "nameoftheaccount": Succeeded placing pixel

    But after that nothing happens, is it supposed to start and I should restart the batch file every 5min or is it running alone and has a cooldown of 5min?

    bug 
    opened by Wolfarya 5
Owner
Deepak Ramalingam
Former Augmented Reality Software Engineer Intern (Intelligent Creation Lab) @ TikTok | Computer Science @ Georgia Institute of Technology (Georgia Tech)
Deepak Ramalingam
A Python script that generates subtitles and renders them onto the video.

DeepSubtitles A Python script that generates subtitles and renders them to the video. This was made as a submission for the DeepGram x Dev Hackathon H

Dhravya Shah 23 Aug 25, 2022
This is the official PyTorch implementation of TBSR. Our team received 2nd place (real data track) and 3rd place (synthetic track) in NTIRE 2022 Burst Super-Resolution Challenge (CVPRW 2022).

Transformer for Burst Image Super-Resolution (TBSR) This is the official PyTorch implementation of TBSR. Our team received 2nd place (real data track)

Zhilu Zhang 11 Jul 26, 2022
This is code that will use the KeyAuth. It will Autoinstall modules onto system. Make a config if one doesnt already exist.

keyauth-cli-login This is code that will use the KeyAuth. It will Autoinstall modules onto system. Make a config if one doesnt already exist. How to u

null 1 May 20, 2022
Implementation of ICML'2021:Neural-Pull: Learning Signed Distance Functions from Point Clouds by Learning to Pull Space onto Surfaces

Neural-Pull: Learning Signed Distance Functions from Point Clouds by Learning to Pull Space onto Surfaces (ICML 2021) This repository contains the off

Baorui Ma 16 Sep 20, 2022
Telegram bot used to enter trades directly from platform onto MT4/MT5 account with calculated trade information.

FX Signal Copier Telegram Bot ?? ?? This Telegram bot allows users to enter trades directly from Telegram and get a detailed look at the risk-to-rewar

Tosin Ogunjobi 4 Sep 19, 2022
Easily Flash Marauder onto the Flipper Zero Devboard or an ESP32!

Easy Flipper Zero Marauder Flash This is for easily flashing Marauder on an ESP32 or WiFi Devboard for a Flipper Zero! It is now simple to install or

null 14 Oct 2, 2022
Something a made a little while back and decided to import it onto here so others can see it.

Double-Pendulum-Simulation Something a made a little while back as a little python project in my free time and decided to import it onto here so other

James N. 1 Sep 19, 2022
A few scripts to draw art to you commit graph on github

GitHub art A few scripts to draw art to you commit graph on github. Running: The art to draw is defined in gendates.py, you likley want to edit it. Th

null 8 Jun 16, 2022
A very simple tool to draw pixel graphics in excel for small displays. Outputs code to be used in Adafruit GFX library.

Pixel-Graphics-Excel-Tool-for-Small-Displays A very simple tool to draw pixel graphics in excel for small displays such as OLED or TFT. Uses openpyxl

David Colby 5 May 13, 2022
External python overlay to draw simple graphic primitives upon the window.

External python overlay Working in not fullscreen and borderless mode only. Easy usage: from externalpyoverlay import Overlay from random import randi

null 2 Apr 26, 2022
Draw candlesticks charts right into your terminal, using Python!

Python Candlesticks Chart ?? Draw candlesticks charts right into your terminal, using Python! This is a portage from the great cli-candlestick-chart (

Mickaël Schoentgen 8 Aug 30, 2022
Draw Traceroute results in a world map.

Traceroute_On_World_Map Draw Traceroute results in a world map. Traceroute is a networking utility that shows all the path that a packet takes from it

Mohamed Admane 1 Jun 14, 2022
Let's draw Mandelbrot set !!

Mandelbrot_draw Let's draw Mandelbrot set !! 元ネタ このコードは以下のホームページ様のコードをかなり参考にしています。 https://watlab-blog.com/2020/05/23/mandelbrot-set/ https://ossa2019

buchi1002 1 Jul 31, 2022
Draw intertwined threads, knots and knitting figures with PyCairo

Intertwined Draw intertwined threads, knots and knitting figures with PyCairo Overall Idea Threads (paths) are made of segments (Bezier curves) with t

Nicolas Seriot 1 Sep 9, 2022
A Simple Challenge For Students To Analyze and Draw Conclusions from their personal Spotify Data :)

SpotifyDataAnalysisChallenge The Task Your task is to take the code given in the main.py file, and analyze the songs in your favorite spotify playlist

Noam Yakar 3 Sep 14, 2022
Modified reddit-place-script to bring the Genshin Impact logo back to the canvas.

genshin-place-war by genshindb.net Modified reddit-place-script to bring the Genshin Impact logo back to the canvas. UPDATE People have decided to dra

null 1 Apr 2, 2022
Formats your Image to match with r/place's pixelated form and color palette.

reddit-Place-Image-Formatter Formats your Image to match with r/place's pixelated form and color palette. HOW TO USE: run.py, Console Menu: To create

null 5 Apr 16, 2022
This is the source code of the 7th place solution for stereo image super resolution task in 2022 CVPR NTIRE challenge.

Swin-iPASSR This is the source code of the 7th place solution for stereo image super resolution task in 2022 CVPR NTIRE challenge (Team Name: No War).

Chenxu Peng 5 May 8, 2022
A r/Place image coordinate editor

Coordinator a r/Place image coordinate editor usage: install python (tested with python 3.9)] install Pillow using "pip install Pillow" in your cmd do

null 4 Apr 4, 2022