Pack up to 3MB of data into a tweetable PNG polyglot file.

Overview

tweetable-polyglot-png

Pack up to 3MB of data into a tweetable PNG polyglot file.

See it in action here: https://twitter.com/David3141593/status/1371974874856587268

How?

Twitter strips unnecessary data from PNG uploads, however, they do not strip trailing data from the DEFLATE stream inside the IDAT chunk, provided that the overall image file meets the requirements to avoid being re-encoded.

Why?

Dunno.

Cover image requirements

The cover image must compress well, such that the compressed filesize is less than (width * height) - size_of_embedded_file. If the cover image does not have a palette, then it must have at least 257 unique colours (otherwise twitter will optimise it to use a palette).

The resolution can be up to 4096x4096, however, be aware that twitter will serve a downscaled version by default, for images greater than 680x680 (depending on your display DPI, etc.).

The image should not have any unecessary metadata chunks. I used these export settings in GIMP:

image

Embedded file requirements

The total output file size must be less than 3MB (maybe 5MB?), otherwise twitter will convert the PNG to a JPEG.

If the embedded file is a .zip, then the offsets are automatically adjusted so that the overall file is still a valid zip. For any other file formats, you're on your own (many will work without any special handling, notably .pdf, .mp3).

Comments
  • MP3 file won't play

    MP3 file won't play

    I created image with embem mp3 file

    Image size: 2765x4096px
    Embedded file starts at offset 0x2a74c1
    

    Issue is that after making png into mp3 it plays 10 sec of silence.

    opened by kodxana 10
  • Doesn't produce full final image

    Doesn't produce full final image

    I took this image toonoo and embedded it with an mp3 of "Booty Wave" from the onion (lol they were the first mp3 and png I had in my downloads folder) and had this as the final result senanbooty as you can see, this is not the same image as the original, although the audio part of it still works if I add the .mp3 extension at the end. (you'll have to play it in vlc as the default windows mp3 player doesn't work with it)

    In addition, just to double check, I got this image Ticox and an mp3 of Toxic by Britney Spears with this as the result Toxic

    opened by tomnookisgay 3
  • FileNotFoundError: [Errno 2] No such file or directory: 'cover.png'

    FileNotFoundError: [Errno 2] No such file or directory: 'cover.png'

    I've been trying to use this tool but I can't figure out how to really use it.

    I have a cover.png and a content.zip but I can't get an output. If I do python pack.py cover.png content.bin output.png I'll get the following: FileNotFoundError: [Errno 2] No such file or directory: 'cover.png' despite having a cover.png

    opened by XeroShi 1
  • update: remove fixup_zip function

    update: remove fixup_zip function

    twitter process png images differently base on image size according to https://tweeterism.com/goodbye-png-the-images-that-you-upload-to-twitter-will-be-converted-to-jpg.html twitter just processes image base on image size and image format, so it is worked after removed fixup_zip function.

    opened by repoog 1
  • Not Working Anymore?

    Not Working Anymore?

    I used the tool to make a PNG, and it does work and open. But when uploaded and downloaded through Twitter, it doesn't work anymore. It seems like the image has been compressed to a couple kilobytes. Any ideas? I tried using the original image in the tweet that David posted, but even that didn't work.

    opened by macfrombv 1
  • Inconsistent Imgur Link behavior

    Inconsistent Imgur Link behavior

    I'm not sure what exactly triggers it, but when opening the direct imgur URL from the readme https://i.imgur.com/kNhGrN3.png Imgur will often redirect do the gallery page for the image instead: https://imgur.com/kNhGrN3 image

    The img displayed on this page is no longer the original png, but instead a webp: image https://i.imgur.com/kNhGrN3_d.webp?maxwidth=760&fidelity=grand which breaks the encryption.

    When the redirect occurs it happens for both clicking the direct link or manually pasting the direct link into the address bar. However after it occurring several times in a row (which prompted me to creating this issue) it now does not happen, and I can open the direct link without issue image

    I've observed this inconsistent behavior previously with my own images, especially when attempting to open a direct link on mobile. I'm not sure if there is a consistent way to avoid this, so I'd potentially recommend not listing imgur as supported, as when it does this the image displayed to the user will not work.

    I'm using Chrome Version 94.0.4606.71 for Windows 10

    opened by JohannesMP 0
Owner
David Buchanan
Making things for breaking things.       a.k.a Retr0id
David Buchanan
Automatically render tens of thousands of unique NFT images individually as png's.

Blend_My_NFTs Description This project is a work in progress (as of Oct 24th, 2021) and will eventually be an add on to Blender. Blend_My_NFTs is bing

Torrin Leonard 894 Dec 29, 2022
This is a story bot, that will scrape stories from r/stories subreddit and convert it into an Audio File.

Introduction This is a story bot, that will scrape stories from r/stories subreddit and convert it into an Audio File. Installation pip install -r req

Yasho 11 Jun 30, 2022
Process your transactions from etherscan (and other forks) into excel file for easier manipulation.

DEGEN TRACKER Read first This is my first Python open source project and it is very likely full of bad practices and security issues. You should not u

null 1 Oct 13, 2022
Parse discord tokens from any file, even if there is other shit in the file with them.

Discord-Token-Parser Parse discord tokens from any file, even if there is other shit in the file with them. Any. File. I glued together all html from

null 4 May 7, 2022
This bot is created by AJTimePyro and It accepts direct downloading url & then return file as telegram file.

URL Uploader Bot This is the source code of URL Uploader Bot. And the developer of this bot is AJTimePyro, His Telegram Channel & Group. You can use t

Abhijeet 23 Nov 13, 2022
First Party data integration solution built for marketing teams to enable audience and conversion onboarding into Google Marketing products (Google Ads, Campaign Manager, Google Analytics).

Megalista Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analy

Google 76 Dec 29, 2022
🔮 A usefull set of scripts to dig into your Discord data package.

Discord DataExtractor ?? Discord DataExtractor is a set of scripts that allows you to dig into your Discord Data package. Repository guide ☕ Coffee_Ga

null 3 Dec 29, 2021
Twitter bot that turns comment chains into ace attorney scenes. Inspired by and using https://github.com/micah5/ace-attorney-reddit-bot

Ace Attorney twitter Bot Twitter bot that turns comment chains into ace attorney scenes. Inspired by and using https://github.com/micah5/ace-attorney-

Luis Mayo Valbuena 542 Dec 17, 2022
A tool for exporting Telegram group chats into static websites, preserving chat history like mailing list archives.

tg-archive is a tool for exporting Telegram group chats into static websites, preserving chat history like mailing list archives. Preview The @fossuni

Kailash Nadh 400 Dec 27, 2022
Using a Gameboy emulator and making it into a DIscord bot !

Gameboy-Discord Using a Gameboy emulator and making it into a Discord bot ! Im not the best at doing this, and i suck at coding so its completely unde

null 7 Oct 18, 2022
Turns any script into a telegram bot

pytobot Turns any script into a telegram bot Install pip install --upgrade pytobot Usage Script: while True: message = input() if message == "

Dmitry Kotov 17 Jan 6, 2023
Powerful Telegram userbot to turn your PROFILE PICTURE & LAST NAME into a real time clock & to change your BIO automatically.

DATE_TIME_USERBOT-TeLeTiPs Powerful Telegram userbot to turn your PROFILE PICTURE & LAST NAME into a real time clock & to change your BIO automaticall

null 53 Jan 5, 2023
Written in Python, freezed into stand-alone executable with PyInstaller. This app will make sure you stay in New World without getting kicked for inactivity.

New World - AFK Written in Python, freezed into stand-alone executable with PyInstaller. This app will make sure you stay in New World without getting

Rodney 5 Oct 31, 2021
Terraform module to ship CloudTrail logs stored in a S3 bucket into a Kinesis stream for further processing and real-time analysis.

AWS infrastructure to ship CloudTrail logs from S3 to Kinesis This repository contains a Terraform module to ship CloudTrail logs stored in a S3 bucke

Nexthink 8 Sep 20, 2022
A program to convert YouTube channel registration information into Json files for ThirdTube.

ThirdTubeImporter A program to convert YouTube channel registration information into Json files for ThirdTube. Usage Japanese https://takeout.google.c

Hidegon 2 Dec 18, 2021
A github actions + python code to extract URLs to code repositories to put into standard form, starting with github

A github actions + python code to extract URLs to code repositories to put into standard form, starting with github ---- NOTE: JUS

Justin Gosses 2 Nov 15, 2021
Translates English into Mandalorian (Mando'a) utilizing a "funtranslations" free API

Mandalorian Translator Translates English into Mandalorian (Mando'a) utilizing a "funtranslations" free API About I created this app to experiment wit

Hayden Covington 1 Dec 4, 2021
Utility for converting IP Fabric webhooks into a Teams format

IP Fabric Webhook Integration for Microsoft Teams and/or Slack Setup IP Fabric Setup Go to Settings > Webhooks > Add webhook Provide a name URL will b

Community Fabric 1 Jan 26, 2022
A reddit bot that imitates the popular reddit bot "u/repostsleuthbot" to trick people into clicking on a rickroll

Reddit-Rickroll-Bot A reddit bot that imitates the popular reddit bot "u/repostsleuthbot" to trick people into clicking on a rickroll Made with The Py

null 0 Jul 16, 2022