npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

accountpicture-ms-extractor

v2.1.1

Published

Extracts image files embedded within an .accountpicture-ms file

Downloads

29

Readme

About

Extracts image files embedded within an .accountpicture-ms file.

NB: I made a "web converter" just for fun as well: https://xan105.github.io/node-accountpicture-ms-extractor/

.accountpicture-ms file

Located in

  • %appdata%/Microsoft/Windows/AccountPictures (Windows 8, 10)
  • %appdata%/Microsoft/Windows/Account Pictures (Windows 11)

There are either 2 PNG or JPEG image files:

  • Lowres: 96x96
  • Highres: usually 448x448 (upscaled if necessary).

From my experience: Microsoft seems to be changing the format, resolution (only for highres), compression ratio (If JPEG), etc... used for the embedded images over time.

As of this writing they are using JPEG: 96x96 and 448x448. But not that long ago they were using PNG and before that JPEG highres was the original resolution of the file you used for your account's picture.

NB:

  • For JPEG both files have a JPEG and JFIF header.
  • There can be more than one .accountpicture-ms file in the mentionned folders.
  • The extension .accountpicture-ms is hidden by the explorer even when set to display file extension.
  • The current used {SourceId}.accountpicture-ms can be determined via the registry key HKCU/Software/Microsoft/Windows/CurrentVersion/AccountPicture/SourceId

Example

import extract from "accountpicture-ms-extractor";
import { join } from "node:path";

const sourceID = "37a1276dd7295e1a";
const dirPath = join(process.env.APPDATA,"Microsoft/Windows/AccountPictures");
const filePath = join(dirPath,`${sourceID}.accountpicture-ms`);

const { highres, lowres } = await extract(filePath);

//save to file
import { writeFile } from "node:fs/promises";
await writeFile(`./${sourceID}.${highres.format}`, highres.buffer);

//data url  
const base64 = highres.base64();
console.log(base64);
// "data:image/jpeg;charset=utf-8;base64,....."

I'm actually using this in xan105/Achievement Watcher to display user's profile picture in the app (Electron). Using the .base64() method you can read and display the picture without any prior extraction to disk.

Install

npm install accountpicture-ms-extractor

API

⚠️ This module is only available as an ECMAScript module (ESM) starting with version 2.0.0. Previous version(s) are CommonJS (CJS) with an ESM wrapper.

Default export

(filePath: string): Promise<obj>

Extracts image files embedded within an .accountpicture-ms file.

Promise returns the following object:

{
  lowres : {
    buffer: Buffer, //file as a Buffer
    format: string, //file format "png" or "jpeg"
    base64(): string, //return file as a base64 encoded string
    blob(): Blob //return file as a Blob
  },
  highres: {
    buffer: Buffer,
    format: string,
    base64(): string,
    blob(): Blob
  }
}