apexify.js 5.0.3 → 5.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +381 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,18 +4,153 @@
4
4
 
5
5
  ![ApexPainter Banner](https://imgur.com/0E9GTmP)
6
6
 
7
- **The Ultimate TypeScript Canvas Library for Node.js**
7
+ **🚀 One Library. Infinite Possibilities. Professional Results.**
8
8
 
9
9
  [![npm version](https://badge.fury.io/js/apexify.js.svg)](https://badge.fury.io/js/apexify.js)
10
10
  [![npm downloads](https://img.shields.io/npm/dt/apexify.js.svg)](https://www.npmjs.com/package/apexify.js)
11
11
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
12
12
  [![Node.js](https://img.shields.io/badge/Node.js-16%2B-green.svg)](https://nodejs.org/)
13
+ [![Next.js](https://img.shields.io/badge/Next.js-Compatible-black?logo=next.js)](https://nextjs.org/)
14
+ [![Discord](https://img.shields.io/badge/Discord-Bot%20Ready-7289DA?logo=discord)](https://discord.com/)
13
15
  [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
14
16
 
15
- *Create stunning visuals with professional-grade canvas rendering, image processing, and text effects*
17
+ **The most powerful, versatile canvas rendering library for Node.js, Next.js, Discord bots, and beyond.**
18
+
19
+ *Create stunning visuals, generate images on-the-fly, build design tools, and power your applications with professional-grade canvas rendering and image processing.*
16
20
 
17
21
  </div>
18
22
 
23
+ ## 🌟 Why ApexPainter?
24
+
25
+ **ApexPainter is not just another canvas library** - it's a complete visual creation toolkit that works everywhere:
26
+
27
+ - ✅ **Next.js** - Perfect for both frontend and backend image generation
28
+ - ✅ **Discord Bots** - Create dynamic images, welcome cards, level-up cards, and more
29
+ - ✅ **Server-Side Rendering** - Generate images in API routes, server actions, and edge functions
30
+ - ✅ **Design Tools** - Build Photoshop-like applications with code export capabilities
31
+ - ✅ **Web Applications** - Power your websites with dynamic image generation
32
+ - ✅ **Automation** - Batch process images, create thumbnails, generate social media assets
33
+ - ✅ **E-commerce** - Generate product images, banners, and marketing materials
34
+ - ✅ **Social Media** - Create profile pictures, cover images, and post graphics
35
+ - ✅ **Gaming** - Generate game assets, UI elements, and character cards
36
+ - ✅ **Business** - Create business cards, certificates, and professional documents
37
+
38
+ **One library. Every use case. Zero compromises.**
39
+
40
+ ---
41
+
42
+ ## 🎯 Perfect For
43
+
44
+ ### 🚀 **Next.js Applications**
45
+ Generate images in your Next.js app - both client and server-side. Perfect for:
46
+ - **API Routes**: Generate images on-demand via API endpoints
47
+ - **Server Actions**: Create images in server-side functions
48
+ - **Static Generation**: Pre-generate images at build time
49
+ - **Edge Functions**: Lightweight image generation at the edge
50
+ - **ISR (Incremental Static Regeneration)**: Update images dynamically
51
+
52
+ ```typescript
53
+ // Next.js API Route Example
54
+ // app/api/generate-image/route.ts
55
+ import { ApexPainter } from 'apexify.js';
56
+ import { NextResponse } from 'next/server';
57
+
58
+ export async function GET() {
59
+ const painter = new ApexPainter();
60
+ const canvas = await painter.createCanvas({
61
+ width: 1200,
62
+ height: 630,
63
+ gradientBg: {
64
+ type: 'linear',
65
+ colors: [
66
+ { stop: 0, color: '#667EEA' },
67
+ { stop: 1, color: '#764BA2' }
68
+ ]
69
+ }
70
+ });
71
+ return new NextResponse(canvas.buffer, {
72
+ headers: { 'Content-Type': 'image/png' }
73
+ });
74
+ }
75
+ ```
76
+
77
+ ### 🤖 **Discord Bots**
78
+ Create stunning visuals for your Discord bot:
79
+ - **Welcome Cards**: Personalized welcome images for new members
80
+ - **Level-Up Cards**: Celebrate user achievements with custom graphics
81
+ - **Profile Cards**: Generate user profile images with stats
82
+ - **Leaderboards**: Visual leaderboard images
83
+ - **Custom Commands**: Generate images on-demand via slash commands
84
+ - **Event Graphics**: Create event banners and announcements
85
+
86
+ ```typescript
87
+ // Discord Bot Example (discord.js)
88
+ import { ApexPainter } from 'apexify.js';
89
+ import { AttachmentBuilder } from 'discord.js';
90
+
91
+ const painter = new ApexPainter();
92
+ const canvas = await painter.createCanvas({
93
+ width: 800,
94
+ height: 400,
95
+ customBg: { source: userAvatar },
96
+ // Add welcome text, decorations, etc.
97
+ });
98
+
99
+ const attachment = new AttachmentBuilder(canvas.buffer, { name: 'welcome.png' });
100
+ await channel.send({ files: [attachment] });
101
+ ```
102
+
103
+ ### 🎨 **Design Tools & Photoshop-Like Apps**
104
+ Build powerful design applications:
105
+ - **Visual Design Editors**: Create drag-and-drop design tools
106
+ - **Code Export**: Convert visual designs into ApexPainter code
107
+ - **Template Systems**: Pre-built templates for common designs
108
+ - **Layer Management**: Complex compositions with multiple layers
109
+ - **Export Options**: Multiple formats (PNG, JPEG, WebP, AVIF)
110
+ - **Batch Processing**: Process multiple designs at once
111
+
112
+ ```typescript
113
+ // Design Tool with Code Export
114
+ const design = {
115
+ canvas: { width: 1920, height: 1080, colorBg: '#ffffff' },
116
+ elements: [
117
+ { type: 'shape', source: 'rectangle', x: 100, y: 100, /* ... */ },
118
+ { type: 'text', text: 'Hello World', x: 200, y: 200, /* ... */ }
119
+ ]
120
+ };
121
+
122
+ // Generate code from design
123
+ const code = generateApexPainterCode(design);
124
+ // Export as: await painter.createCanvas(...)
125
+ ```
126
+
127
+ ### 🌐 **Web Applications**
128
+ Power your websites with dynamic image generation:
129
+ - **OG Images**: Generate Open Graph images for social sharing
130
+ - **Thumbnails**: Auto-generate thumbnails for content
131
+ - **Banners**: Create dynamic banners and headers
132
+ - **User Avatars**: Generate custom avatars with initials
133
+ - **Charts & Graphs**: Visualize data with beautiful charts
134
+ - **QR Codes**: Generate QR codes with custom styling
135
+
136
+ ### 📱 **Social Media & Marketing**
137
+ Create professional marketing materials:
138
+ - **Social Media Posts**: Generate posts for Instagram, Twitter, Facebook
139
+ - **Story Graphics**: Create engaging story images
140
+ - **Banner Ads**: Design eye-catching banner advertisements
141
+ - **Email Graphics**: Generate images for email campaigns
142
+ - **Product Images**: Create product showcases and catalogs
143
+
144
+ ### 🎮 **Gaming Applications**
145
+ Generate game assets and UI elements:
146
+ - **Character Cards**: Create character profile cards
147
+ - **Achievement Badges**: Design achievement and trophy graphics
148
+ - **Game UI**: Generate UI elements and HUD components
149
+ - **Loading Screens**: Create dynamic loading screen graphics
150
+ - **Leaderboards**: Visual leaderboard displays
151
+
152
+ ---
153
+
19
154
  ## ✨ Features Overview
20
155
 
21
156
  ### 🖼️ **Advanced Image Processing**
@@ -74,9 +209,35 @@
74
209
  ### Installation
75
210
 
76
211
  ```bash
77
- npm install apexify
212
+ # npm
213
+ npm install apexify.js
214
+
215
+ # yarn
216
+ yarn add apexify.js
217
+
218
+ # pnpm
219
+ pnpm add apexify.js
78
220
  ```
79
221
 
222
+ ### Platform Support
223
+
224
+ ✅ **Node.js** - Full support (v16+)
225
+ ✅ **Next.js** - Frontend & Backend (App Router & Pages Router)
226
+ ✅ **Discord.js** - Perfect for Discord bots
227
+ ✅ **Express.js** - API endpoints and server-side rendering
228
+ ✅ **Serverless** - AWS Lambda, Vercel, Netlify Functions
229
+ ✅ **Docker** - Containerized applications
230
+ ✅ **Edge Runtime** - Vercel Edge, Cloudflare Workers (with limitations)
231
+
232
+ ### Works Everywhere
233
+
234
+ - 🖥️ **Server-Side**: Full feature support
235
+ - 🌐 **API Routes**: Generate images on-demand
236
+ - ⚡ **Edge Functions**: Lightweight image generation
237
+ - 🤖 **Discord Bots**: Dynamic image creation
238
+ - 🎨 **Design Tools**: Build visual editors
239
+ - 📱 **Web Apps**: Client and server-side rendering
240
+
80
241
  ### Basic Usage
81
242
 
82
243
  ```typescript
@@ -630,19 +791,6 @@ const buttonText = await painter.createText({
630
791
 
631
792
  ## 📚 API Reference
632
793
 
633
- ### Core Methods
634
-
635
- | Method | Description | Parameters |
636
- |--------|-------------|------------|
637
- | `createCanvas()` | Create a new canvas with background | `CanvasConfig` |
638
- | `createImage()` | Add shapes/images to canvas | `ImageProperties \| ImageProperties[]` |
639
- | `createText()` | Add text to canvas | `TextProperties \| TextProperties[]` |
640
- | `createChart()` | Generate charts | `ChartConfig` |
641
- | `createGIF()` | Create animated GIFs | `GIFConfig` |
642
- | `save()` | Save buffer to local file with advanced options | `Buffer, SaveOptions?` |
643
- | `saveMultiple()` | Save multiple buffers in batch | `Buffer[], SaveOptions?` |
644
- | `resetSaveCounter()` | Reset the save counter for naming | `void` |
645
-
646
794
  ### 🔄 **Flexible Parameters**
647
795
 
648
796
  Both `createImage()` and `createText()` methods accept:
@@ -680,7 +828,7 @@ This allows you to add multiple elements in one call for better performance and
680
828
 
681
829
  ---
682
830
 
683
- ## 🆕 What's New in v4.9.30
831
+ ## 🆕 What's New in v5.0.0
684
832
 
685
833
  ### 🎉 Major Feature Release
686
834
 
@@ -717,6 +865,222 @@ See [CHANGELOG.md](CHANGELOG.md) for complete details.
717
865
 
718
866
  ---
719
867
 
868
+ ## 💼 Real-World Use Cases
869
+
870
+ ### 🎯 **Next.js Image Generation API**
871
+
872
+ ```typescript
873
+ // app/api/og-image/route.ts
874
+ import { ApexPainter } from 'apexify.js';
875
+ import { NextRequest, NextResponse } from 'next/server';
876
+
877
+ export async function GET(request: NextRequest) {
878
+ const searchParams = request.nextUrl.searchParams;
879
+ const title = searchParams.get('title') || 'Default Title';
880
+
881
+ const painter = new ApexPainter();
882
+ const canvas = await painter.createCanvas({
883
+ width: 1200,
884
+ height: 630,
885
+ gradientBg: {
886
+ type: 'linear',
887
+ colors: [
888
+ { stop: 0, color: '#667EEA' },
889
+ { stop: 1, color: '#764BA2' }
890
+ ]
891
+ }
892
+ });
893
+
894
+ const image = await painter.createText({
895
+ text: title,
896
+ x: 600,
897
+ y: 315,
898
+ fontSize: 72,
899
+ bold: true,
900
+ color: '#FFFFFF',
901
+ textAlign: 'center'
902
+ }, canvas);
903
+
904
+ return new NextResponse(image, {
905
+ headers: { 'Content-Type': 'image/png' }
906
+ });
907
+ }
908
+ ```
909
+
910
+ ### 🤖 **Discord Bot Welcome Card**
911
+
912
+ ```typescript
913
+ // discord-bot.ts
914
+ import { ApexPainter } from 'apexify.js';
915
+ import { Client, GatewayIntentBits, AttachmentBuilder } from 'discord.js';
916
+
917
+ const client = new Client({ intents: [GatewayIntentBits.GuildMembers] });
918
+ const painter = new ApexPainter();
919
+
920
+ client.on('guildMemberAdd', async (member) => {
921
+ // Create welcome card
922
+ const canvas = await painter.createCanvas({
923
+ width: 1024,
924
+ height: 500,
925
+ customBg: { source: './assets/welcome-bg.jpg' }
926
+ });
927
+
928
+ const image = await painter.createText([
929
+ {
930
+ text: `Welcome ${member.user.username}!`,
931
+ x: 512,
932
+ y: 200,
933
+ fontSize: 48,
934
+ bold: true,
935
+ color: '#FFFFFF',
936
+ textAlign: 'center'
937
+ },
938
+ {
939
+ text: `You are member #${member.guild.memberCount}`,
940
+ x: 512,
941
+ y: 280,
942
+ fontSize: 32,
943
+ color: '#CCCCCC',
944
+ textAlign: 'center'
945
+ }
946
+ ], canvas);
947
+
948
+ const attachment = new AttachmentBuilder(image, { name: 'welcome.png' });
949
+ await member.guild.systemChannel?.send({ files: [attachment] });
950
+ });
951
+ ```
952
+
953
+ ### 🎨 **Design Tool with Code Export**
954
+
955
+ ```typescript
956
+ // design-editor.ts
957
+ import { ApexPainter } from 'apexify.js';
958
+
959
+ class DesignEditor {
960
+ private painter = new ApexPainter();
961
+ private design: any = { elements: [] };
962
+
963
+ // Add element to design
964
+ addElement(element: any) {
965
+ this.design.elements.push(element);
966
+ }
967
+
968
+ // Render design
969
+ async render() {
970
+ const canvas = await this.painter.createCanvas(this.design.canvas);
971
+ let buffer = canvas.buffer;
972
+
973
+ for (const element of this.design.elements) {
974
+ if (element.type === 'shape') {
975
+ buffer = await this.painter.createImage(element, buffer);
976
+ } else if (element.type === 'text') {
977
+ buffer = await this.painter.createText(element, buffer);
978
+ }
979
+ }
980
+
981
+ return buffer;
982
+ }
983
+
984
+ // Export as ApexPainter code
985
+ exportCode() {
986
+ return `
987
+ import { ApexPainter } from 'apexify.js';
988
+
989
+ const painter = new ApexPainter();
990
+ const canvas = await painter.createCanvas(${JSON.stringify(this.design.canvas, null, 2)});
991
+ ${this.design.elements.map((el: any, i: number) =>
992
+ `const step${i} = await painter.${el.type === 'shape' ? 'createImage' : 'createText'}(${JSON.stringify(el, null, 2)}, ${i === 0 ? 'canvas' : `step${i-1}`});`
993
+ ).join('\n')}
994
+ `.trim();
995
+ }
996
+ }
997
+ ```
998
+
999
+ ### 📊 **Dynamic Chart Generation**
1000
+
1001
+ ```typescript
1002
+ // analytics-dashboard.ts
1003
+ import { ApexPainter } from 'apexify.js';
1004
+
1005
+ async function generateAnalyticsChart(data: number[]) {
1006
+ const painter = new ApexPainter();
1007
+
1008
+ const chart = await painter.createChart({
1009
+ chartType: 'bar',
1010
+ chartNumber: 1,
1011
+ data: {
1012
+ chartData: { width: 800, height: 400 },
1013
+ xLabels: data.map((_, i) => i),
1014
+ yLabels: [0, 25, 50, 75, 100],
1015
+ data: {
1016
+ xAxis: data.map((value, i) => ({
1017
+ label: `Day ${i + 1}`,
1018
+ value,
1019
+ position: { startsXLabel: i * 80, endsXLabel: (i + 1) * 80 }
1020
+ })),
1021
+ yAxis: data
1022
+ }
1023
+ }
1024
+ });
1025
+
1026
+ return chart;
1027
+ }
1028
+ ```
1029
+
1030
+ ### 🖼️ **Batch Image Processing**
1031
+
1032
+ ```typescript
1033
+ // image-processor.ts
1034
+ import { ApexPainter } from 'apexify.js';
1035
+
1036
+ async function processUserUploads(images: string[]) {
1037
+ const painter = new ApexPainter();
1038
+
1039
+ // Process all images in parallel
1040
+ const results = await painter.batch(
1041
+ images.map(image => ({
1042
+ type: 'image' as const,
1043
+ config: {
1044
+ source: image,
1045
+ x: 0,
1046
+ y: 0,
1047
+ filters: [{ type: 'gaussianBlur', radius: 5 }],
1048
+ borderRadius: 20
1049
+ }
1050
+ }))
1051
+ );
1052
+
1053
+ // Save all processed images
1054
+ await painter.saveMultiple(results, {
1055
+ directory: './processed',
1056
+ prefix: 'processed-',
1057
+ naming: 'counter'
1058
+ });
1059
+
1060
+ return results;
1061
+ }
1062
+ ```
1063
+
1064
+ ---
1065
+
1066
+ ## 🎓 Learning Resources
1067
+
1068
+ ### 📺 **Video Tutorials**
1069
+ Comprehensive video series covering:
1070
+ - Getting started with ApexPainter
1071
+ - Next.js integration
1072
+ - Discord bot development
1073
+ - Building design tools
1074
+ - Advanced features and techniques
1075
+
1076
+ ### 📚 **Documentation**
1077
+ - [Full API Reference](http://apexifyjs.jedi-studio.com)
1078
+ - [Examples Gallery](#examples)
1079
+ - [TypeScript Types](#typescript-support)
1080
+ - [Performance Guide](#performance)
1081
+
1082
+ ---
1083
+
720
1084
  ## 🤝 Contributing
721
1085
 
722
1086
  We welcome contributions! Here's how you can help:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apexify.js",
3
- "version": "5.0.3",
3
+ "version": "5.0.4",
4
4
  "description": "🎨 Advanced Canvas Rendering Library - Professional image processing, shape drawing, text effects, patterns, filters, and charts. Built with TypeScript & Rust for high performance.",
5
5
  "author": "zenith-79",
6
6
  "license": "MIT",