telegram-crawler/data/web/core.telegram.org/api/wallpapers.html

226 lines
22 KiB
HTML
Raw Normal View History

2022-11-15 01:03:58 +01:00
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Wallpapers</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram apps support generating, sharing and synchronizing chat backgrounds.">
<meta property="og:title" content="Wallpapers">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram apps support generating, sharing and synchronizing chat backgrounds.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
2023-03-20 12:08:32 +01:00
<link href="/css/telegram.css?236" rel="stylesheet" media="screen">
2022-11-15 01:03:58 +01:00
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/wallpapers" >Wallpapers</a></li></ul></div>
<h1 id="dev_page_title">Wallpapers</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram apps support generating, sharing and synchronizing chat backgrounds.</p>
<p>Wallpapers must be rendered according to the instructions contained in the wallpaper constructors. </p>
<h3><a class="anchor" href="#wallpaper-types" id="wallpaper-types" name="wallpaper-types"><i class="anchor-icon"></i></a>Wallpaper types</h3>
<p>There are three main wallpaper types:</p>
<ul>
<li><a href="#image-wallpapers">Image wallpapers</a></li>
<li><a href="#pattern-wallpapers">Pattern wallpapers</a></li>
<li><a href="#fill-wallpapers">Fill wallpapers</a></li>
</ul>
<p>Fill and pattern wallpapers are generated using one of three <a href="#fill-types">fill types</a>.</p>
<h4><a class="anchor" href="#image-wallpapers" id="image-wallpapers" name="image-wallpapers"><i class="anchor-icon"></i></a>Image wallpapers</h4>
<pre><code><a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>Image wallpapers are wallpapers described by a <a href="/constructor/wallPaperNoFile">wallPaper</a> constructor, containing a JPEG image in the <code>document</code> field.<br>
The <code>settings</code> field describes the transforms that should be applied to the image if the corresponding flags are set: </p>
<ul>
<li><code>settings.blur</code>: The image should be downscaled to fit in 450x450 square and then box-blurred with radius 12.</li>
<li><code>settings.motion</code>: The image needs to be slightly moved when device is tilted, allowing for a parallax effect.</li>
</ul>
<p>All other <code>settings</code> flags should be ignored. </p>
<h4><a class="anchor" href="#pattern-wallpapers" id="pattern-wallpapers" name="pattern-wallpapers"><i class="anchor-icon"></i></a>Pattern wallpapers</h4>
<pre><code><a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>Pattern wallpapers are wallpapers described by a <a href="/constructor/wallPaperNoFile">wallPaper</a> constructor with the <code>pattern</code> flag set, combining the <a href="#fill-types">color fill</a> specified by the <code>settings</code> field with the PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern image contained in the <code>document</code> field. </p>
<p>The pattern image should be completely transparent, except for the pattern itself which should be shades of black.</p>
<p>The following flags in the <code>settings</code> field describe how should the pattern be combined with the color fill:</p>
<ul>
<li><code>settings.intensity</code>: A value ranging from -100 to 100.<ul>
<li>Values from 0 to 100 mean that the pattern should be overlaid on top of the <a href="#fill-types">color fill</a> with the specified intensity (@ 100 the black pattern is fully visible on the background fill, @ 0 only the background fill is visible). </li>
<li>Values from -1 to -100 mean that the pattern should be inverted (black background, transparent pattern) before overlaying on top of the <a href="#fill-types">color fill</a> with the specified intensity (@ -100 the filled pattern is fully visible on a black background, @ -1 only black is visible). </li>
</ul>
</li>
<li><code>settings.motion</code>: The pattern needs to be slightly moved on top of the background when device is tilted, allowing for a parallax effect.</li>
</ul>
<h4><a class="anchor" href="#fill-wallpapers" id="fill-wallpapers" name="fill-wallpapers"><i class="anchor-icon"></i></a>Fill wallpapers</h4>
<pre><code><a href='/constructor/wallPaperNoFile'>wallPaperNoFile</a>#e0804116 id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> default:flags.1?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;</code></pre>
<p>Fill wallpapers are simple wallpapers described by the <a href="/constructor/wallPaperNoFile">wallPaperNoFile</a> constructor, containing only the <a href="#fill-types">fill</a> specified by the <code>settings</code> field. </p>
<h3><a class="anchor" href="#fill-types" id="fill-types" name="fill-types"><i class="anchor-icon"></i></a>Fill types</h3>
<p>Fill and pattern wallpapers are generated using one of three fill types: </p>
<ul>
<li><a href="#solid-fill">Solid fill</a></li>
<li><a href="#gradient-fill">Gradient fill</a></li>
<li><a href="#freeform-gradient-fill">Freeform gradient fill</a></li>
</ul>
<h4><a class="anchor" href="#solid-fill" id="solid-fill" name="solid-fill"><i class="anchor-icon"></i></a>Solid fill</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>If out of the <code>*_background_color</code> flags only <code>background_color</code> is set, the fill is made of just the specified RGB-24 color.</p>
<h4><a class="anchor" href="#gradient-fill" id="gradient-fill" name="gradient-fill"><i class="anchor-icon"></i></a>Gradient fill</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>If out of the <code>*_background_color</code> flags only <code>background_color</code> and <code>second_background_color</code> are set, the fill is made of a top-bottom (background-second_background) gradient of the specified RGB-24 colors.<br>
If set, <code>rotation</code> indicates clockwise rotation angle of the gradient, in degrees; 0-359. Must be always divisible by 45, default to 0 if not set. </p>
<h4><a class="anchor" href="#freeform-gradient-fill" id="freeform-gradient-fill" name="freeform-gradient-fill"><i class="anchor-icon"></i></a>Freeform gradient fill</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;</code></pre>
<p>If the <code>background_color</code>, <code>second_background_color</code>, <code>third_background_color</code> and optionally <code>fourth_background_color</code> flags are set, the fill is made of a freeform gradient of the specified 3 or 4 RGB-24 colors. </p>
<h3><a class="anchor" href="#wallpaper-api" id="wallpaper-api" name="wallpaper-api"><i class="anchor-icon"></i></a>Wallpaper API</h3>
<h4><a class="anchor" href="#uploading-wallpapers" id="uploading-wallpapers" name="uploading-wallpapers"><i class="anchor-icon"></i></a>Uploading wallpapers</h4>
<pre><code><a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;
<a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
---functions---
<a href='/method/account.uploadWallPaper'>account.uploadWallPaper</a>#dd853661 file:<a href='/type/InputFile'>InputFile</a> mime_type:<a href='/type/string'>string</a> settings:<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;</code></pre>
<p><a href="/method/account.uploadWallPaper">account.uploadWallPaper</a> is used to upload <a href="#image-wallpapers">image</a> and <a href="#pattern-wallpapers">pattern</a> wallpapers.<br>
<a href="#fill-wallpapers">Fill wallpapers</a> don't require uploading since they have no associated file, and a <a href="/constructor/wallPaper">wallPaper</a> constructor can directly be generated client-side, specifying <code>id=0</code>. </p>
<p>Wallpapers can then be shared using a <a href="/api/links#wallpaper-links">wallpaper deep link »</a>, and/or <a href="#installing-wallpapers">installed as specified here (image and pattern wallpapers only) »</a>. </p>
<h4><a class="anchor" href="#installing-wallpapers" id="installing-wallpapers" name="installing-wallpapers"><i class="anchor-icon"></i></a>Installing wallpapers</h4>
<pre><code><a href='/constructor/inputWallPaper'>inputWallPaper</a>#e630b979 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/inputWallPaperSlug'>inputWallPaperSlug</a>#72091c80 slug:<a href='/type/string'>string</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/wallPaper'>wallPaper</a>#a437c3ed id:<a href='/type/long'>long</a> flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> pattern:flags.3?<a href='/constructor/true'>true</a> dark:flags.4?<a href='/constructor/true'>true</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> document:<a href='/type/Document'>Document</a> settings:flags.2?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#1dc1bca4 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;
<a href='/constructor/account.wallPapersNotModified'>account.wallPapersNotModified</a>#1c199183 = <a href='/type/account.WallPapers'>account.WallPapers</a>;
<a href='/constructor/account.wallPapers'>account.wallPapers</a>#cdc3858c hash:<a href='/type/long'>long</a> wallpapers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/WallPaper'>WallPaper</a>&gt; = <a href='/type/account.WallPapers'>account.WallPapers</a>;
---functions---
<a href='/method/account.getWallPaper'>account.getWallPaper</a>#fc8ddbea wallpaper:<a href='/type/InputWallPaper'>InputWallPaper</a> = <a href='/type/WallPaper'>WallPaper</a>;
<a href='/method/account.getMultiWallPapers'>account.getMultiWallPapers</a>#65ad71dc wallpapers:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputWallPaper'>InputWallPaper</a>&gt; = <a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/WallPaper'>WallPaper</a>&gt;;
<a href='/method/account.saveWallPaper'>account.saveWallPaper</a>#6c5a5b37 wallpaper:<a href='/type/InputWallPaper'>InputWallPaper</a> unsave:<a href='/type/Bool'>Bool</a> settings:<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/account.installWallPaper'>account.installWallPaper</a>#feed5769 wallpaper:<a href='/type/InputWallPaper'>InputWallPaper</a> settings:<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/account.getWallPapers'>account.getWallPapers</a>#7967d36 hash:<a href='/type/long'>long</a> = <a href='/type/account.WallPapers'>account.WallPapers</a>;
<a href='/method/account.resetWallPapers'>account.resetWallPapers</a>#bb3b9804 = <a href='/type/Bool'>Bool</a>;</code></pre>
<p>Once you've <a href="#uploading-wallpapers">uploaded your wallpaper</a> or received a <a href="/api/links#wallpaper-links">wallpaper deep link</a>, it can be installed as follows. </p>
<p><em>Note that <a href="#fill-wallpapers">fill wallpapers</a> cannot be installed using the API, clients should install and keep track of them only locally, without synchronizing the wallpaper list or signaling installations.</em></p>
<p>The API keeps a list of wallpapers that the user can set as chat background, including some preinstalled ones.<br>
To fetch the list use <a href="/method/account.getWallPapers">account.getWallPapers</a>.<br>
To save a wallpaper to the list use <a href="/method/account.saveWallPaper">account.saveWallPaper</a> with <code>unsave=false</code>.<br>
To remove a wallpaper (including preinstalled wallpapers) from the list use <a href="/method/account.saveWallPaper">account.saveWallPaper</a> with <code>unsave=true</code>.<br>
To restore the default list, removing all installed wallpapers and reinstalling previously removed preinstalled wallpapers use <a href="/method/account.resetWallPapers">account.resetWallPapers</a>. </p>
<p>When a client sets a wallpaper as the default chat background, call <a href="/method/account.installWallPaper">account.installWallPaper</a> to signal this installation to the server.<br>
Note that calling this method will also automatically save the wallpaper, if it's not present in the saved wallpapers list. </p>
<p>In all cases where an <a href="/type/InputWallPaper">InputWallPaper</a> constructor is required, pass: </p>
<ul>
<li><a href="/constructor/inputWallPaperSlug">inputWallPaperSlug</a> when working with <a href="/api/links#wallpaper-links">wallpaper deep links</a>.</li>
<li><a href="/constructor/inputWallPaper">inputWallPaper</a> otherwise, using the ID and access hash fields of a full <a href="/constructor/wallPaper">wallPaper</a>.<br>
As mentioned earlier, <a href="#fill-wallpapers">fill wallpapers</a> can't be saved to the server: an <a href="/constructor/inputWallPaperNoFile">inputWallPaperNoFile</a> is available for fill wallpapers but can <strong>only</strong> be used when working with <a href="/api/themes">themes »</a>.</li>
</ul></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/privacy">Privacy</a></li>
<li><a href="//telegram.org/press">Press</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/android">Android</a></li>
<li><a href="//telegram.org/dl/web">Mobile Web</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)">Twitter</a></h5>
</div>
</div>
</div>
</div>
2022-12-10 23:50:15 +01:00
<script src="/js/main.js?47"></script>
2022-11-15 01:03:58 +01:00
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>