Package 'smpic'

Title: Creates Images Sized for Social Media
Description: Creates images that are the proper size for social media. Beautiful plots, charts and graphs wither and die if they are not shared. Social media is perfect for this but every platform has its own image dimensions. With smpic you can easily save your plots with the exact dimensions need for the different platforms.
Authors: Mikkel Freltoft Krogsholm
Maintainer: Mikkel Freltoft Krogsholm <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2025-01-24 03:27:56 UTC
Source: https://github.com/mikkelkrogsholm/smpic

Help Index


Overview of Image Dimensions for Social Media

Description

This data set contains dimensions for 32 different images sizes for most social media sites

Usage

smpic_dim

Format

A data frame with 32 rows and 6 variables:

media

the social media in question

picture

the type of image in question

width

the width of image in question

height

the height of image in question

dimension

the dimension of image in question - height / width

id

the id of image in question

Source

https://makeawebsitehub.com/social-media-image-sizes-cheat-sheet/


Save a social media sized ggplot

Description

Save a social media sized ggplot

Usage

smpic_save(p, filename = NULL, sm = c("facebook_shared_images",
  "facebook_profile_image", "facebook_cover_photo", "facebook_shared_link",
  "facebook_highlighted_image", "facebook_event_image",
  "linkedin_profile_image", "linkedin_standard_logo", "linkedin_hero_image",
  "linkedin_business_banner_image", "linkedin_square_logo",
  "youtube_channel_cover_photo", "youtube_video_uploads",
  "instagram_profile_image", "instagram_photo_thumbnails",
  "instagram_photo_size", "twitter_header_photo", "twitter_profile_image",
  "twitter_in-stream_photo",      "pinterest_profile_image",
  "pinterest_board_display", "pinterest_board_display_thumbnails",
  "pinterest_pin_sizes", "tumblr_profile_image", "tumblr_image_posts",
  "g+_profile_image", "g+_cover_image", "g+_shared_image", "g+_shared_video",
  "g+_shared_image_square", "ello_banner_image", "ello_profile_image"),
  text_factor = 1)

Arguments

p

the ggplot you want to preview.

filename

filename for your plot.

sm

the social media picture type you want it sized to.

text_factor

a factor for the text in the plot. Change it if the text looks to small.

Examples

library(dplyr)
library(ggplot2)
library(smpic)

p <- ggplot(iris) +
     geom_point(aes(Petal.Length, Petal.Width, color = Species), show.legend = FALSE) +
       geom_label(data = summarise_if(group_by(iris, Species), is.numeric, mean),
                  aes(Petal.Length, Petal.Width, label = Species, color = Species),
                  show.legend = FALSE) +
       labs(x = "Petal Length", y = "Petal Width",
            title = "Look mom, a flower plot!",
            subtitle = "Yet another iris data set visualization.",
            caption = "Source: iris") +
       theme_minimal()

  smpic_view(p, sm = "facebook_shared_images", text_factor = 2.2)

  smpic_save(p, filename = "my_new_social_media_plot.png",
             sm = "facebook_shared_images", text_factor = 2.2)

Preview a social media sized ggplot

Description

Preview a social media sized ggplot

Usage

smpic_view(p, sm = c("facebook_shared_images", "facebook_profile_image",
  "facebook_cover_photo", "facebook_shared_link", "facebook_highlighted_image",
  "facebook_event_image", "linkedin_profile_image", "linkedin_standard_logo",
  "linkedin_hero_image", "linkedin_business_banner_image",
  "linkedin_square_logo", "youtube_channel_cover_photo",
  "youtube_video_uploads", "instagram_profile_image",
  "instagram_photo_thumbnails", "instagram_photo_size", "twitter_header_photo",
  "twitter_profile_image", "twitter_in-stream_photo",     
  "pinterest_profile_image", "pinterest_board_display",
  "pinterest_board_display_thumbnails", "pinterest_pin_sizes",
  "tumblr_profile_image", "tumblr_image_posts", "g+_profile_image",
  "g+_cover_image", "g+_shared_image", "g+_shared_video",
  "g+_shared_image_square", "ello_banner_image", "ello_profile_image"),
  text_factor = 1)

Arguments

p

the ggplot you want to preview.

sm

the social media picture type you want it sized to.

text_factor

a factor for the text in the plot. Change it if the text looks to small.

Value

a plot

Examples

library(dplyr)
library(ggplot2)
library(smpic)

p <- ggplot(iris) +
     geom_point(aes(Petal.Length, Petal.Width, color = Species), show.legend = FALSE) +
       geom_label(data = summarise_if(group_by(iris, Species), is.numeric, mean),
                  aes(Petal.Length, Petal.Width, label = Species, color = Species),
                  show.legend = FALSE) +
       labs(x = "Petal Length", y = "Petal Width",
            title = "Look mom, a flower plot!",
            subtitle = "Yet another iris data set visualization.",
            caption = "Source: iris") +
       theme_minimal()

  smpic_view(p, sm = "facebook_shared_images", text_factor = 2.2)