<p>Image wallpapers are wallpapers described by a <ahref="/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>
<p>Pattern wallpapers are wallpapers described by a <ahref="/constructor/wallPaperNoFile">wallPaper</a> constructor with the <code>pattern</code> flag set, combining the <ahref="#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 <ahref="#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 <ahref="#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>
<p>Fill wallpapers are simple wallpapers described by the <ahref="/constructor/wallPaperNoFile">wallPaperNoFile</a> constructor, containing only the <ahref="#fill-types">fill</a> specified by the <code>settings</code> field. </p>
<p><ahref="#fill-wallpapers">Fill wallpapers</a> with an <code>emoticon</code> contained in the associated wallpaper <code>settings</code> indicate a channel wallpaper, that can be <ahref="#installing-wallpapers-in-a-specific-chat-or-channel">installed »</a> in channels that have enough boosts, <ahref="#installing-wallpapers-in-a-specific-chat-or-channel">see here »</a> for more info. </p>
<p>The full list of channel wallpapers can be fetched using <ahref="/method/account.getChatThemes">account.getChatThemes</a>. </p>
<p>Channels may also set any custom wallpaper (not just the ones returned by <ahref="/method/account.getChatThemes">account.getChatThemes</a>) after reaching a higher boost level, <ahref="#installing-wallpapers-in-a-specific-chat-or-channel">see here »</a> for more info. </p>
<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>
<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>
<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>
<p><ahref="/method/account.uploadWallPaper">account.uploadWallPaper</a> is used to upload <ahref="#image-wallpapers">image</a> and <ahref="#pattern-wallpapers">pattern</a> wallpapers. The <code>for_chat</code> flag must be set when uploading wallpapers to be used with <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>.<br>
<ahref="#fill-wallpapers">Fill wallpapers</a> don't require uploading since they have no associated file, and a <ahref="/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 <ahref="/api/links#wallpaper-links">wallpaper deep link »</a>, and/or <ahref="#installing-wallpapers">installed as specified here (image and pattern wallpapers only) »</a>. </p>
<p>Once you've <ahref="#uploading-wallpapers">uploaded your wallpaper</a> or received a <ahref="/api/links#wallpaper-links">wallpaper deep link</a>, it can be installed as follows. </p>
<p><em>Note that <ahref="#fill-wallpapers">fill wallpapers</a> cannot be globally installed using <ahref="/method/account.installWallPaper">account.installWallPaper</a> or <ahref="/method/account.saveWallPaper">account.saveWallPaper</a>, 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 <ahref="/method/account.getWallPapers">account.getWallPapers</a>.<br>
To save a wallpaper to the list use <ahref="/method/account.saveWallPaper">account.saveWallPaper</a> with <code>unsave=false</code>.<br>
To remove a wallpaper (including preinstalled wallpapers) from the list use <ahref="/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 <ahref="/method/account.resetWallPapers">account.resetWallPapers</a>. </p>
<p>When a client sets a wallpaper as the default chat background, call <ahref="/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 <ahref="/type/InputWallPaper">InputWallPaper</a> constructor is required, pass: </p>
<ul>
<li><ahref="/constructor/inputWallPaperSlug">inputWallPaperSlug</a> when working with <ahref="/api/links#wallpaper-links">wallpaper deep links</a>.</li>
<li><ahref="/constructor/inputWallPaper">inputWallPaper</a> otherwise, using the ID and access hash fields of a full <ahref="/constructor/wallPaper">wallPaper</a>.<br>
As mentioned earlier, <ahref="#fill-wallpapers">fill wallpapers</a> can't be saved to the server using <ahref="/method/account.installWallPaper">account.installWallPaper</a> or <ahref="/method/account.saveWallPaper">account.saveWallPaper</a>: an <ahref="/constructor/inputWallPaperNoFile">inputWallPaperNoFile</a> is available for fill wallpapers but can <strong>only</strong> be used when working with <ahref="/api/themes">themes »</a> or when using <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a> as follows.</li>
</ul>
<h4><aclass="anchor"href="#installing-wallpapers-in-a-specific-chat-or-channel"id="installing-wallpapers-in-a-specific-chat-or-channel"name="installing-wallpapers-in-a-specific-chat-or-channel"><iclass="anchor-icon"></i></a>Installing wallpapers in a specific chat or channel</h4>
<p>Wallpapers can also be installed in a specific private chat, by using <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>: this will emit a <ahref="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> service message, displaying the wallpaper in the UI along with an invitation for the other user to apply the same wallpaper. </p>
<p>To <code>wallpaper</code>, pass an: </p>
<ul>
<li><ahref="/constructor/inputWallPaperSlug">inputWallPaperSlug</a> when working with <ahref="/api/links#wallpaper-links">wallpaper deep links</a>.</li>
<li><ahref="/constructor/inputWallPaperNoFile">inputWallPaperNoFile</a> for <ahref="#fill-wallpapers">fill wallpapers</a>. </li>
<li><ahref="/constructor/inputWallPaper">inputWallPaper</a> otherwise, using the ID and access hash fields of a full <ahref="/constructor/wallPaper">wallPaper</a>. </li>
<p>If the other user decides to apply the same wallpaper to the chat, <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a> should be invoked passing the wallpaper <code>settings</code> received in the <ahref="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> service message (or some different settings, if the user customized them before applying the wallpaper), along with the <code>id</code> of the <ahref="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a> service message, <strong>without</strong> the <code>wallpaper</code>: this way, the action will emit a <ahref="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a><strong>with the <code>same</code> flag set</strong>, which should be displayed in the UI as a simple acknowledgment service message, without the full wallpaper and without an invitation for the other user to apply it (since both participants already just did that). </p>
<p>However, if we have <ahref="/api/premium">Premium</a> subscription, we can change the other user's wallpaper without explicit confirmation from the other side: to do so, set the <code>for_both</code> flag when invoking <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>.<br>
This will change the wallpaper for both sides of the chat, without requiring confirmation; the <ahref="/constructor/userFull">userFull</a>.<code>wallpaper_overridden</code> flag will also be set for the other user; the action will also emit a <ahref="/constructor/messageActionSetChatWallPaper">messageActionSetChatWallPaper</a><strong>with the <code>for_both</code> flag set</strong>.<br>
If the other user does not like the new wallpaper we have chosen for them, they can re-set their previous wallpaper just on their side, by invoking <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>, providing only the <code>revert</code> flag (and obviously the <code>peer</code> parameter). </p>
<p>Note that in order to pass <ahref="#image-wallpapers">image</a> or <ahref="#pattern-wallpapers">pattern</a> wallpapers to <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a>, the <code>for_chat</code> flag must be set when <ahref="#uploading-wallpapers">uploading them with account.uploadWallPaper</a>. </p>
<p>Also note that unlike <ahref="/method/account.installWallPaper">account.installWallPaper</a> or <ahref="/method/account.saveWallPaper">account.saveWallPaper</a>, <ahref="/method/messages.setChatWallPaper">messages.setChatWallPaper</a> accepts <ahref="#fill-wallpapers">fill wallpapers</a> as well.</p>
<p>Wallpaper changes will also emit an <ahref="/constructor/updatePeerWallpaper">updatePeerWallpaper</a> update.</p>
<p>After reaching at least the <ahref="/api/boost">boost level</a> specified in the <ahref="/api/config#channel-wallpaper-level-min"><code>channel_wallpaper_level_min</code> config parameter</a>, channels gain the ability to set one of the <ahref="#channel-wallpapers">fill channel wallpapers returned by account.getChatThemes (see » for more info)</a>. </p>
<p>After reaching at least the boost level specified in the <ahref="/api/config#channel-custom-wallpaper-level-min"><code>channel_custom_wallpaper_level_min</code> config parameter</a>, channels gain the ability to set any custom <ahref="/api/wallpapers">wallpaper</a>, not just fill channel wallpapers. </p>
<p>When setting channel wallpapers, do <strong>not</strong> set the <code>for_both</code> flag.</p></div>